#2583: can't use ForeignKey in list view (class Admin: list_display)
-----------------------------+----------------------------------------------
 Reporter:  235              |        Owner:  adrian  
     Type:  defect           |       Status:  reopened
 Priority:  normal           |    Milestone:          
Component:  Admin interface  |      Version:  SVN     
 Severity:  normal           |   Resolution:          
 Keywords:                   |  
-----------------------------+----------------------------------------------
Changes (by Rob):

  * resolution:  worksforme =>
  * status:  closed => reopened

Comment:

 Same problem here, an exmaple
 
 
 {{{
 class Content(models.Model):
     body        = models.CharField(maxlength=1024)
 
 class Rating(models.Model):
     body        = models.CharField(maxlength=1024)
     severity    = models.IntegerField()
     type        = models.CharField(maxlength=128)
     application = models.CharField(maxlength=128)
 
     class Admin:
         list_display = ('type', 'severity', 'body', 'application')
 
     def __str__(self):
         return "%s" % (self.type)
 
     class Meta:
         verbose_name_plural = "Ratings"
 
 class Message(models.Model):
     content     = models.ForeignKey(Content)
     rating      = models.ForeignKey(Rating)
     body        = models.CharField(maxlength=1024)
     date        = models.DateTimeField(auto_now=True)
     errclass    = models.CharField(maxlength=128)
 
     class Admin:
         list_display = ('errclass', 'body')
 
     def __str__(self):
         return "%s" % (self.body)
 
     class Meta:
         verbose_name_plural = "Messages"
 }}}
 
 When adding 'content' or 'rating' to the list_display of Messages, the
 admin view is empty, i.e. no list is generated. Maybe something to do with
 the fact that the Message model contains TWO foreign keys?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2583>
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