Hi,
I am using modelformset_factory and I want to show all the ocurrences of
the class Event, but I want to add a field to the fromset. I have this code:
-------------------- forms.py ---------------------
from django import forms
from django.forms.formsets import BaseFormSet
class ExtendeEventFormSet(BaseFormSet):
def add_fields(self, form, index):
super(ExtendeEventFormSet, self).add_fields(form, index)
form.fields["reduced_price"] = forms.CharField()
-------------------- forms.py ---------------------
in my view I have:
#EventFormSet = modelformset_factory(Event, extra=1) # Option A
EventFormSet = modelformset_factory(Event, formset=ExtendeEventFormSet)
# Option B
eventFormSet = EventFormSet()
When I am rendering the results in the (A) case, it shows all the
entries in the DDBB without the new field. In the other case (B), the
new field is shown but the entries(data) are not rendered.
Anyone know what is wrong with this?
Thanks!,
Xavi
--
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@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.