#13618: prepopulated_fields crashes with get_readonly_fields
------------------------------------------------+---------------------------
               Reporter:  tonnzor               |         Owner:  tobias
                 Status:  assigned              |     Milestone:  1.3   
              Component:  django.contrib.admin  |       Version:  SVN   
             Resolution:                        |      Keywords:        
           Triage Stage:  Accepted              |     Has patch:  1     
    Needs documentation:  0                     |   Needs tests:  0     
Patch needs improvement:  1                     |  
------------------------------------------------+---------------------------
Changes (by russellm):

  * needs_better_patch:  0 => 1
  * stage:  Ready for checkin => Accepted


Comment:

 To my eyes, This isn't RFC.

 There is definitely a problem here, but this patch only partially
 addresses it it. This patch removes the validation error, but leaves the
 admin in a state where it isn't actually doing something useful -- it
 allows you to define a readonly propopulated field, but then doesn't
 actually provide any way to populate the slug. As a result, saving an
 object results in empty/default slug values. This will only ever work for
 the first object; subsequent slugs won't be unique.

 Either:
  1) Raise a validation error, prohibiting the use of a prepopulated value
 in a readonly.
  2) The prepopulated field needs to be handled as a hidden field -- not
 user-modifiable, but modifiable by javascript, and displayed to the user a
 a fait accompli.

 Doing (2) well will be extremely difficult. It requires a big change to
 readonly_fields, introducing a 'read-only, but submitted as form value'
 type; it also provides no easy way to avoid validation problems when the
 slug isn't unique.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13618#comment:11>
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.

Reply via email to