OK, that definitely fixed it, but it created another problem.  Here's how it
looks now:

*pub_date = models.DateTimeField('date published', auto_now_add=True)*

Exactly as you'd suggested.  However, I'm now getting the following error on
all pages I hit:

*ImproperlyConfigured at /polls/new/
'PollAdmin.fieldsets[1][1]['fields']' refers to field 'pub_date' that is
missing from the form.*

I got it to work by commenting out a line in my admin.py file that had some
custom stuff set up, per the tutorial.  Here's what that code looks like:

*class PollAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,            {'fields': ['question']}),
**#### THE OFFENDING LINE LIES HITHER:::*
*        ('Date Information',    {'fields': ['pub_date'], 'classes':
['collapse']}),
    ]
    inlines = [ChoiceInline]
    list_display = ('question', 'last_vote_date', 'pub_date',
'was_published_today')
    list_filter = ['pub_date']
    search_fields = ['question']
    date_hierarchy = 'pub_date'
*

I suspect I've now moved on to a problem in a new area.  The thing I don't
quite get is why adding auto_now_add to the pub_date field in the model
broke this.   Any ideas?




On Sun, Dec 21, 2008 at 9:51 PM, Malcolm Tredinnick <
malc...@pointy-stick.com> wrote:

>
> On Sun, 2008-12-21 at 21:46 -0700, Greg Schwimer wrote:
> > OK, that was very helpful, thank you.  Yes, my problem is because I am
> > not setting the date.   Thinking it through, I don't want the user
> > changing this, so it would be helpful to use the auto_now_add idea you
> > suggested.  However, I can't get that working.  Here's my mode;
> > definition for pub_date:
> >
> >      pub_date = models.DateTimeField('date published')
> >
> > The docs you referred to suggest the approach might look something
> > like this:
> >
> >     pub_date = models.DateTimeField([auto_now_add=True], 'date
> > published)
>
> The square brackets in documentation are a fairly standard way of saying
> that parameter is optional. To use the parameter, type it in without the
> square brackets. Thus:
>
>        pub_date = models.DateTimeField('date published', auto_now_add=True)
>
> Regards,
> Malcolm
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to