Tuesday, February 1, 2011

Formset problem

Hi,

I wanna to display a THREE recursive ModelForms in a
single page in my django admin
so i chose my code like that

this is my ModelAdmin module

admin.py

class JobAdminForm(forms.ModelForm):
class Meta:
model = Job #Job is my model

description = forms.CharField(widget=widgets.TinyMCE(attrs={'cols':
80, 'rows':20}))

from django.forms.formsets import formset_factory
JobAdminFormSet = formset_factory(JobAdminForm,extra=3)


class JobAdmin(admin.ModelAdmin):
formset = JobAdminFormSet()
def save_formset(self, request, form, formset, change):
instances = formset.save(commit=False)
for instance in instances:
instance.user = request.user
instance.save()
formset.save_m2m()

admin.site.register(Job,JobAdmin)

It is not displaying
What is the problem with that? How to display it?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment