#23616: 'GenericRel' object has no attribute 'get_related_field'
-------------------------------------+-------------------------------------
     Reporter:  ranjur               |                    Owner:  kswiat
         Type:  Bug                  |                   Status:  assigned
    Component:                       |                  Version:  master
  contrib.contenttypes               |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:  GenericRel, django   |  Unreviewed
  1.7, admin, get_related_field,     |      Needs documentation:  0
  GenericRelation                    |  Patch needs improvement:  0
    Has patch:  0                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by kswiat):

 * status:  new => assigned
 * owner:  nobody => kswiat
 * version:  1.7 => master


Comment:

 I have reproduced this bug, it affects master as well.

 {{{
 #!div style="font-size: 80%"
 contrib/admin/options.py, line 420
   {{{#!python
   rel_name = field.rel.get_related_field().name
   }}}
 }}}

 simple getattr() seems to solve it:


 {{{
 #!div style="font-size: 80%"

   {{{#!python
   rel_name = getattr(field.rel, 'get_related_name', model._meta.pk.name)
   }}}
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23616#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6e7c1ed66a67b1f276e4d2f7f4ce75ea%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to