Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Model Administration First Model

Travis Spencer
Travis Spencer
4,639 Points

Django Basics - Challenge Task 2 of 3 - DateTimeField

I am confused as to what I am missing in regards to this question. I have created another attribute, publish_date, with a DateTimeField with no arguments. Can someone please advise what step I am missing.

Thanks!

articles/models.py
from django.db import models


# Create your models here

class Article(models.Model): 
    headline = models.CharField(max_length=255) 
    publish_date = models.DateTimeField() 
Travis Spencer
Travis Spencer
4,639 Points

Here is the actual task instructions: Now add another field to the Article model named publish_date. It should be a DateTimeField and have no arguments.

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

Your code looks fine to me (pretty much identical to mine)-- I redid the challenge and paste what passed for me.

from django.db import models

# Create your models here
class Article(models.Model):
    headline = models.CharField(max_length=255)
    publish_date = models.DateTimeField()
    content = models.TextField()
Travis Spencer
Travis Spencer
4,639 Points

Thanks, Jeff! It worked. I appreciate your help.

was stuck on the same bug but the snippet worked, thanks!

Jonathan Fernatt
Jonathan Fernatt
4,335 Points

It looks like the code in the challenge is double tabbed. Fixing that resolved the issue for me.