Django exception when trying to show a DateTimeField on an admin form -


i have model defines datetimefield:

dateadded = models.datetimefield("date added", auto_now_add=true) 

in modeladmin subclass i'm trying show field in following field set:

fieldsets = (     (none, {         'fields': (             ("modelid", "altmodelids", "modelname", "dateadded"),             ("manufacturer", "protocol", "category"),             ("versionadded", "proonly", "published", "discontinued"),             "notes"         )     }), 

but following error:

fielderror: unknown field(s) (dateadded) specified device 

interestingly, though, when add list_display:

list_display = ("modelname", "published", "modelid", "altmodelids", "manufacturer", "protocol", "category", "dateadded") 

it works fine. i'm sure i'm doing stupid (i've been away django 8 months) can't figure out. appreciated.

because datetimefield model field types marked auto_now_add implicitly given editable=false aren't shown on change forms. if specify field in field set in modeladmin class, it's apparently not considered in model because it's read-only. silly error message since in model that's way is.

now figure out how show field read-only on change form model (but that's different problem).


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -