Hola,

django-extra-views is a really good app for CBVs with FormSets (after
I wasted hours on another solution).

While reading the docs, I came across the NamedFormsetsMixin
https://github.com/AndrewIngram/django-extra-views#other-bits-of-functionality

which I thought looked nice, and implemented in my Views - which the
docs kindly explain.

I **cannot** get it to work in my templates though - I've tried
reading the tests and the code itself but cannot for the life of me
work out how to reference the now "inline_names":

views.py
class PersonCreateView(NamedFormsetsMixin, CreateWithInlinesView):
    model = Person
    fields = ['name']
    inlines = [AddressInline, PhoneInline, EmailInline]
    inline_names = ['Address', 'Phone', 'Email']

In the template person_form.py I have tried all of the following
without success:


    {{ Phone }}
    {{ phone }}
    {{ Phones }}
    {{ phones }}

    {{ formset.Phone }}
    {{ formset.phone }}
    {{ inlines.Phone }}
    {{ inlines.phone }}
....
    {{ formset.phones }}
    {{ formset.Phones }}
    {{ inlines.Phones }}
    {{ inlines.phones }}
....
    {{ Phone_formset }}
    {{ Phones_formset }}
    {{ phone_formset }}
    {{ phones_formset }}
.
    {{ formset }}

I know that everything is working otherwise, because the
pre-NamedFormsetsMixin code is working:

{% for formset in inlines %}
    <fieldset>
        {{ formset }}
    </fieldset>
  {% endfor %}

What the hell am I doing wrong? (I already know this is going to be a
head slapper)


cheers
L.




--
We are like a drunk blundering through a crowd of pickpockets. That we
are not poor and naked already is a testament to either the goodness
of humanity or the ineptitude of the criminal class.

http://techcrunch.com/2013/06/08/we-asked-for-this/

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to