Hi,

On Wed, Jul 14, 2010 at 7:51 AM, Jon Walsh <jon.walsh.m...@gmail.com> wrote:

> 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
>
>
If I understand you good how about using javascript to check what kind of
info you enter into the data_type field and it would update the value input
field. Using jquery it would be very easy to implement.

lzantal


> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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