Hello Amit,

Yes, this is solution - I wanted those fields to be shown in admin, I
understand they're read-only. So, I put this in EcoPointAdmin and it
works:

readonly_fields = ['entry_date', 'last_change_date']

Thank you.

On Dec 10, 2:23 pm, Amit <pathakami...@gmail.com> wrote:
> Hi,
>
> You can display entry_date on admin by using readonly attribute of
> admin.
> Set readonly = (entry_date,) this will do your task, but You cannot
> modify this on admin.
>
> Thanks
> Amit
>
> On Dec 9, 7:46 pm, DC <davor.ceng...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have the following lines in my model:
> >     entry_date = models.DateTimeField(auto_now_add=True)
> >     pub_date = models.DateTimeField('date published', blank=True,
> > null=True)
> >     last_change_date = models.DateTimeField(auto_now=True)
>
> > Basically, I want the entry date to be added automatically, and last
> > change date to be updated on every save(), just as described in
> > documentation. The problem is that those fields don't appear on the
> > admin page. I tried with explicitly setting those fields in my admin
> > class, per Tutorial:
>
> > class EcoPointAdmin(admin.ModelAdmin):
> >     fieldsets = [
> >         ('Details', {'fields': ['title', 'description', 'type',
> > 'status']}),
> >         ('Geo data', {'fields': ['latitude', 'longitude']}),
> >         ('Dates', {'fields': ['entry_date', 'pub_date',
> > 'last_change_date']}),
> >     ]
>
> > But now I get the error shown below.
>
> > Any chance to have those fields on admin page, without creating my
> > custom admin? I couldn't find anything useful in the archives.
>
> > Thanks,
> > DC, Django novice
>
> > The error msg:
>
> > ImproperlyConfigured at /admin/ecopoint/ecopoint/3/
>
> > 'EcoPointAdmin.fieldsets[2][1]['fields']' refers to field 'entry_date'
> > that is missing from the form.

-- 
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