Dynamic ModelAdmin Field

30 views
Skip to first unread message

Bernat Bonet

unread,
Jul 14, 2016, 11:29:38 AM7/14/16
to Django users
I need to add dynamic fields to ModelAdmin that are not part of the Model.

Models:

product: cod, des
product_categories: cat, val

I want to add val1, val2 in ProductAdmin

Thanks


Derek

unread,
Jul 15, 2016, 9:46:44 AM7/15/16
to Django users
Why not use custom methods on your model?  These can effectively act as extra properties:

https://docs.djangoproject.com/en/1.9/topics/db/models/#model-methods

(this is assuming you do not want to store any data of course... otherwise you will need to give a more concrete example of what you want to do)
Reply all
Reply to author
Forward
Message has been deleted
0 new messages