On 14/2/18 08:05, Andy wrote:
> Im trying to have a custom admin that is also able to edit some model 
> properties, but putting those properties into my fieldsets its complaining

What would mean to edit a property (assuming this means an attribute
that isn't a model field) in your app? Where would the data go?

> Unknown field(s) (foo, bar) specified for Profile. Check 
> fields/fieldsets/exclude attributes of class ProfileAdmin.
> The properties work in list_display, but im missing something for the edit 
> page.

The Django admin will look only for Django fields in the edit forms,
that's why you're getting the errors.
Since list_display is only for showing data, it will display any
attribute in your model.

> Can i actually do this? So far i didnt find any hint on editing properties 
> with the admin.

What you can do is use a custom model form and add fields to it for the
attributes you want to be able to "edit", but you'll also need to define
what happens with the data either in the custom form class itself, or in
the ModelAdmin class by extending the change_view method.

See the documentation for details:

Gonzalo Delgado

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to