#15602: Using get_readonly_fields and StackedInline/TabularInline admin objects doesn't allow creating new objects, immutible existing objects ----------------------------------+--------------------------- Reporter: bradwhittington | Owner: nobody Status: new | Milestone: Component: django.contrib.admin | Version: 1.2 Keywords: | Triage Stage: Unreviewed Has patch: 0 | ----------------------------------+--------------------------- I am using a pattern described [http://stackoverflow.com/questions/4343535 /django-admin-make-a-field-read-only-when-modifying-obj-but-required-when- adding-n here], on a StackedInline admin class, AKA:
{{{ def get_readonly_fields(self, request, obj = None): if obj: return self.readonly_fields+('text','author','private') return self.readonly_fields }}} But it seems to currently be broken (in 1.2.5), I get all fields repeated twice per object, and the add new object fields are all marked read-only, as if obj is always a non-None value. If I throw logging into that method (log.debug(obj==None)), I am seeing (in an example with one inline object already created): {{{ 2011-03-14 00:23:52 SAST+0000 - DEBUG - task.admin - False 2011-03-14 00:23:52 SAST+0000 - DEBUG - task.admin - True 2011-03-14 00:23:52 SAST+0000 - DEBUG - task.admin - False 2011-03-14 00:23:52 SAST+0000 - DEBUG - task.admin - False }}} -- Ticket URL: <http://code.djangoproject.com/ticket/15602> 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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.