On Mon, 2009-05-11 at 07:55 -0700, eric.frederich wrote: > Hello, > > I need to set up a view for administrators of an application that I am > writing where they can edit a subset of fields on a particular model. > It was pretty simple... > > EnrollmentFormSet = modelformset_factory(Enrollment, extra=2) > > def offering_admin(request, offering_id): > offering = get_object_or_404(Offering, id=offering_id) > formset = EnrollmentFormSet(queryset=offering.enrollment_set.all > ()) > return render_to_response('train/offering_admin_form.html', { > 'formset': formset, > }) > > The problem now is that there is too many fields being exposed. I > want to pick and choose what fields are there. Is there a way for me > to do this without going completely custom?
Yes, modelformset_factory takes arguments 'fields' and 'exclude'. See: http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/#controlling-which-fields-are-used-with-fields-and-exclude sdc > Thanks, > ~Eric --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---