Opened 8 years ago

Closed 8 years ago

#16557 closed Uncategorized (invalid)

Tutorial 1.0 Docs

Reported by: mike@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I'm somewhat new to Django and Python in general but have some experience with ORMs.. I'm wondering about the line in marked with '*' below:

from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    ***pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()

Why is the argument passed to DateTimeField() 'date published', is that an easy name of the field? When I looked at DateTimeField() documentation at I see:

class DateTimeField([auto_now=False, auto_now_add=False, **options])

also the generated SQL made no mention of the string "date published" in a comment or otherwise:

CREATE TABLE "polls_poll" (
    "id" serial NOT NULL PRIMARY KEY,
    "question" varchar(200) NOT NULL,
    "pub_date" timestamp with time zone NOT NULL
CREATE TABLE "polls_choice" (
    "id" serial NOT NULL PRIMARY KEY,
    "poll_id" integer NOT NULL REFERENCES "polls_poll" ("id"),
    "choice" varchar(200) NOT NULL,
    "votes" integer NOT NULL

I'm not sure what **options is so that might be the magic I'm looking for. I'm just saying that as someone looking at these docs for the first time, having pub_date = models.DateTimeField('date published') in there is confusing for someone who is trying to get an idea of what the framework is doing.

Change History (2)

comment:1 Changed 8 years ago by mike@…

I think i see it now that i've drilled down a bit that this is the field's label.. maybe make mention of it as such in the docs where it is being entered in? I see it as part of rendered html on the second page. Sorry for bothering you with this, love what i've seen so far <3.

comment:2 Changed 8 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

For future reference -- the ticket tracker isn't for asking questions, it's for tracking known bugs and issues in Django's code. Questions should be directed to django-users.

Note: See TracTickets for help on using tickets.
Back to Top