#2334: Warning raised when list_filter contains a model method name
----------------------------+-----------------------------------------------
 Reporter:  [EMAIL PROTECTED]     |       Owner:  adrian
     Type:  defect          |      Status:  new   
 Priority:  normal          |   Milestone:        
Component:  Core framework  |     Version:        
 Severity:  normal          |    Keywords:        
----------------------------+-----------------------------------------------
 The Admin {{{list_display}}} property for one of my models contains a
 method name together with a few field names. Everything works ok, but the
 {{{manage.py}}} script displays the following warning:
 
 {{{
 Validating models...
 journals.article: "admin.list_filter" refers to 'get_short_title', which
 isn't a field.
 1 error found.
 }}}
 
 A simple patch to management.py makes the warning go away, but I have no
 idea about possible side-effects:
 
 {{{
 Index: core/management.py
 ===================================================================
 --- core/management.py  (revisione 3336)
 +++ core/management.py  (copia locale)
 @@ -946,7 +946,8 @@
                          try:
                              f = opts.get_field(fn)
                          except models.FieldDoesNotExist:
 -                            e.add(opts, '"admin.list_filter" refers to
 %r, which isn\'t a field.' % fn)
 +                            if not callable(getattr(cls, fn)):
 +                                e.add(opts, '"admin.list_filter" refers
 to %r, which isn\'t a field.' % fn)
                          if fn not in opts.admin.list_display:
                              e.add(opts, '"admin.list_display_links"
 refers to %r, which is not defined in "admin.list_display".' % fn)
                  # list_filter
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2334>
Django <http://code.djangoproject.org/>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to