Tuesday, March 5, 2013

Re: how to add prefix in generic_inlineformset_factory?

I need to create two formset (generic_inlineformset_factory). When i create formset in template used formset_create_company and formset_create_private, field names are the same.

    c['form_create_company'] = User1()

    c['form_create_private'] = User2()

    c['formset_create_company'] = generic_inlineformset_factory(SpecialData, form=SpecialDataForm, extra=1, max_num=2)

    c['formset_create_private'] = generic_inlineformset_factory(SpecialData, form=SpecialDataForm, extra=1, max_num=2)


{{ form_create_company.name }} = created: '<input id="id_core-specialdata-content_type-object_id-0-name" maxlength="200" name="core-specialdata-content_type-object_id-0-name" type="text">'
{{ formset_create_private.name }} = created: '<input id="id_core-specialdata-content_type-object_id-0-name" maxlength="200" name="core-specialdata-content_type-object_id-0-name" type="text">'

I need:

{{ form_create_company.name }} = created: '<input id="id_my_name1-specialdata-content_type-object_id-0-name" maxlength="200" name="my_name1-specialdata-content_type-object_id-0-name" type="text">'
{{ formset_create_private.name }} = created: '<input id="id_my_name2-specialdata-content_type-object_id-0-name" maxlength="200" name="my_name2-specialdata-content_type-object_id-0-name" type="text">'


W dniu wtorek, 5 marca 2013 10:20:36 UTC+1 użytkownik Witold Greń napisał:
How to add prefix in generic_inlineformset_factory()? This is posible?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment