Jon Walsh
unread,Jul 14, 2010, 10:51:09 AM7/14/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hi guys,
This might be best explained by example... for the following model:
class Setting(models.Model):
data_type = models.CharField()
value = models.TextField()
I want Django's admin to display a different form widget for the
"value" field depending on the input of "data_type". For example: if
"data_type" was "date", then the value field would use a date widget
instead of the TextField's default widget.
My predicament is that ModelAdmin is defined as a class, and not
instances. So I can't pass it a custom form since instances (i.e.
"data_type" value) are needed to decide what field the form should
have...
Any help would be greatly appreciated!
thanks, Jon