On Apr 7, 1:05 pm, Simon Willison <[EMAIL PROTECTED]> wrote: > I suppose I could dynamically > construct a ModelForm subclass at runtime (any pointers on how to do > that, including dynamically creating the inner class called "Meta", > would be welcome) but for the above the existing form_for_model() > function is a whole bunch more intuitive.
To answer my own question, it turns out dynamically constructing a class is really easy if you take advantage of closures: def my_form_for_model(model_class): class Form(ModelForm): class Meta: model = model_class return Form I'd still like to see form_for_model stay (or be replaced by the above or similar) rather than being deprecated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---