I got a model looking something like this

class SomeModel(models.Model):
    somefield = models.CharField(max_length=100, choices=somemethod())

The problem is that somemethod, which produces the choices to give in
the form in the admin, is called when the module is imported, not when
the form instance is created. The result from the somemethod call is
dynamic based on custom user defined code and not some static tuple or
list.

So my question is: how can I get the choices to be set at the time of
form creation? Tried overriding the __init__, but then somefield was
only available as a string and I could not set any choice-property.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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