1 Aug 2009 01:31
Dynamic Choices for ChoiceField
mviamari <mviamari <at> gmail.com>
2009-07-31 23:31:05 GMT
2009-07-31 23:31:05 GMT
Hello, I'm trying to make a form for data entry into my database that uses ChoiceFields for foreign keys. Obviously, the ideal choice would be ModelChoiceField, however I'm not using the django ORM, so I've assumed that's not going to work (I'm using Elixir/SQLAlchemy). I originally set the choices parameter in the ChoiceField declaration to be derived from a query result from SQLAlchemy (returned as an array of tuples). The problem is that the choices don't update when the database changes. They are fixed to whatever was present when the server is initialized (or at least it appears to be). I've worked around this by using CharFields and implementing my own validation method that checks for the value in the aforesaid query result. Unforunately, that doesn't help me if i want to use the forms.as_<html> methods. I'm looking for suggestions/advice on to get the ChoiceField choices to update when the form is the used. Thanks, Mike --~--~---------~--~----~------------~-------~--~----~ 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 <at> googlegroups.com To unsubscribe from this group, send email to django-users+unsubscribe <at> googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---(Continue reading)
RSS Feed