#24869: Model unicode and Foreign key
-------------------------------+--------------------
     Reporter:  lefedor        |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Uncategorized  |    Version:  1.8
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 possible bug:


 {{{
 class aModel(Model):
         name = models.CharField(_('name'), null=True, max_length=64,
 blank=True, default=None)

 class bModel(Model):
         aLink = models.ForeignKey(aModel, null=False, blank=False)
         def __unicode__(self):
                 return u'%s' % (self.aLink.name)
 }}}


 gives error at admin:

 RelatedObjectDoesNotExist at ....
 bModel has no aLink.

 same for
 {{{
         def __unicode__(self):
                 return u'%s' % str(self.id)
 }}}

 but works with
 {{{
         def __unicode__(self):
                 return u'%s' % (self.id.aLink.name)
 }}}

 is it correct?

--
Ticket URL: <https://code.djangoproject.com/ticket/24869>
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/050.ed9b1ffcc5cf770cf2cfb9a65366dac1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to