#16034: get_field_display: Django needs a filter to allow get_field_display for 
a
dynamic field
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  thepapermen                        |         Status:  new
                   Type:  New        |      Component:  Template system
  feature                            |       Severity:  Normal
              Milestone:             |       Keywords:
                Version:  1.3        |      Has patch:  0
             Resolution:             |    Needs tests:  0
           Triage Stage:  Design     |  Easy pickings:  0
  decision needed                    |
    Needs documentation:  0          |
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by thepapermen):

 * ui_ux:   => 0


Comment:

 {{{
 #!div style="font-size: 80%"
 Updating the hypothetical solution:
   {{{#!python
 def human_readable(value, arg):
   if hasattr(value, 'get_' + str(arg) + '_display'):
       return getattr(value, 'get_%s_display' % arg)()
   elif hasattr(value, str(arg)):
       if callable(getattr(value, str(arg))):
           return getattr(value, arg)()
       else:
           return getattr(value, arg)
   else:
       try:
           return value[arg]
       except KeyError:
           return settings.TEMPLATE_STRING_IF_INVALID
   }}}
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16034#comment:5>
Django <https://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