Hmm, thats almost what I need.  I guess I didn't fully explain what I
need.
I do need to limit the number of fields that are shown, but I also
need to make some of them view only.
For example, this is on a relation table between an Offering object
and a User object called Enrollment.
I don't want them to be able to edit the Offering or the User (which
appear as combo boxes), only some of the other fields on the
Enrollment object like a status field and some boolean fields.
While editing the each Enrollment object they will need to be able to
see who the user is but they don't need to see the Offering (since
this view is all enrollments for a particular offering).

Is this too specialized, will I need to re-invent the wheel here?

On May 11, 11:46 am, Sam Chuparkoff <s...@sadach.org> wrote:
> 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/#control...
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to