#15015: Mixing read-only with ability to add new instances using a FormSet ----------------------+----------------------------------------------------- Reporter: coleifer | Owner: nobody Status: new | Milestone: Component: Forms | Version: 1.2 Keywords: formset | Stage: Unreviewed Has_patch: 0 | ----------------------+----------------------------------------------------- A little background, I've been attempting to add permission-awareness to admin inlines using a technique like the one mentioned here: http://code.djangoproject.com/ticket/8060#comment:9
The problem occurs when I want to allow a user to be able to add new inline instances, but display the pre-existing ones as read-only. By overriding the get_readonly_fields() method in the event the user doesn't have change permissions, I'm able to make everything read-only...but this includes the formset's "extra_forms", or when the user clicks to add a new row. Since read-only is an admin thing and is implemented in the formset-level as "exclude", it's going to be kind of tricky to tell, using just the FormSet API, which fields are actually excluded and which are just read- only. I would propose making readonly_fields an attribute of the form, just like exclude. Additionally, it makes sense to me for any 'extra_forms' on the FormSet to display all non-excluded fields as editable. Having a read-only field on a form that does not contain any data is odd. -- Ticket URL: <http://code.djangoproject.com/ticket/15015> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
