Field Inheritance

12 views
Skip to first unread message

Sepero

unread,
Jan 2, 2012, 3:54:38 PM1/2/12
to Django users
I would like to suggest listing/displaying the Parent Class for
classes on API pages like this-
https://docs.djangoproject.com/en/1.3/ref/models/fields/

In part1 of the Django tutorial, it instructs to create a model like
this-
pub_date = models.DateTimeField('date published')

While trying to look up what the argument 'date published' was
supposed to assign, I was presented with this definition-
class DateTimeField([auto_now=False, auto_now_add=False, **options])

In the description it vaguely indicates that DateTimeField is a child
of DateField (which has the same definition), and I see no indication
at all that DateField is a child of Field.

I apologize if this seems noobish of me to not understand, or if there
is somewhere in the docs with info that I'm just misunderstanding. I
know how to go into the shell to look up parents of objects, but it
would seem that the purpose of an API is to be very explicit about
these kind of things.

Michael Elkins

unread,
Jan 3, 2012, 10:22:58 AM1/3/12
to django...@googlegroups.com
On Mon, Jan 02, 2012 at 12:54:38PM -0800, Sepero wrote:
>I would like to suggest listing/displaying the Parent Class for
>classes on API pages like this-
>https://docs.djangoproject.com/en/1.3/ref/models/fields/
>
>In part1 of the Django tutorial, it instructs to create a model like
>this-
>pub_date = models.DateTimeField('date published')
>
>While trying to look up what the argument 'date published' was
>supposed to assign, I was presented with this definition-

I agree that it is not obvious in the tutorial what the first
argument is setting. It is documented elsewhere:

https://docs.djangoproject.com/en/1.3/topics/db/models/#verbose-field-names

>class DateTimeField([auto_now=False, auto_now_add=False, **options])
>
>In the description it vaguely indicates that DateTimeField is a child
>of DateField (which has the same definition), and I see no indication
>at all that DateField is a child of Field.

The description says "Takes the same extra arguments as
DateField." I think all it implies is that it is similar to
DateField.

Sepero

unread,
Jan 3, 2012, 12:26:23 PM1/3/12
to Django users
It would also be nice to have the definition for the base Field class
listed on the Models reference page
class Field(verbose_name="", null=False, etc.......)

Other classes like DateTimeField have their definition listed, so it
would seem to make sense.
class DateTimeField([auto_now=False, auto_now_add=False, **options])


On Jan 3, 10:22 am, Michael Elkins <m...@sigpipe.org> wrote:
> On Mon, Jan 02, 2012 at 12:54:38PM -0800, Sepero wrote:
> >I would like to suggest listing/displaying the Parent Class for
> >classes on API pages like this-
> >https://docs.djangoproject.com/en/1.3/ref/models/fields/
>
> >In part1 of the Django tutorial, it instructs to create a model like
> >this-
> >pub_date = models.DateTimeField('date published')
>
> >While trying to look up what the argument 'date published' was
> >supposed to assign, I was presented with this definition-
>
> I agree that it is not obvious in the tutorial what the first
> argument is setting.  It is documented elsewhere:
>
> https://docs.djangoproject.com/en/1.3/topics/db/models/#verbose-field...
Reply all
Reply to author
Forward
0 new messages