On Friday, June 28, 2013 3:23:00 PM UTC-5, MacVictor wrote:
and how to get only Form (not ModelForm) use string name?--
W dniu piątek, 28 czerwca 2013 22:09:41 UTC+2 użytkownik MacVictor napisał:get the model by string i use:from django.db.models.loading import get_modeldef get_model(self, app_label, model_name, seed_cache=True):how to get ModelForm by string?i try used:modelforms = forms.ModelForm.__subclasses__() def get_form(form):try:for model_form in modelforms:try:if model_form.Meta.form == form:return model_formexcept AttributeError:continueexcept IndexError:print "Does not exist Model Forms for the object"but I must import the form in which I will seek appropriate by name!
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment