I don't think one it's possible to add to the "fields" admin option,
so you'll end up having all editable fields in it:

class MyModel()
    field1 = models.CharField(editable=False)
    field2 = models.CharField()
    ...
    fieldn = models.SomeField()

Class MyModelAdmin()
  fields = {"field1", "field2", ... "fieldn"}

Which is not very DRY, because all fields except field1 would have
been there anyway.

Besides, we still need the "readonly_fields" option to make
editable=True fields readonly in the admin interface. For example:

Class MyModelAdmin()
  readonly_fields = {"field1", "field42"}

would made field1 and field42 editable in the add form and readonly in
the change form. It has the added benefit of being more consistent
because fields in the "fields" options are editable and fields in
"readonly_fields" are readonly. Otherwise we end up doing "magic"
depending on whether a field in "fields" is editable or not.

I thus propose to update my patch to do the following:
1) add a "readonly_fields" options in the admin class
2) said option will accept a list of model fields (regardless of their
editable status), which will be editable in the add form and displayed
in the change form
3) editable = False fields will raise an error when added to the
regular "fields" list

I'm really not so sure about 3. We could make "fields" move non-
editable silently to "readonly_fields" instead (and then rely on the
behavior described in 2).

I will update my patch to support feature 2 and wait on input as for
3.

Regards,
Philippe


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to