I have a simple model with a foreign key relation

class A(models.Model):
      id = models.CharField('ABCDEFG', .....)

class B(models.Model):
      def __str__(self):
         return self.name

     class Admin:
         list_display = ('name',)
         list_display_links = ('name',)
         ordering = ('a', 'name')
         search_fields = ('a__id','name')

     a = models.ForeignKey(A, num_in_admin=3)
     name = models.CharField(maxlength=255, core=True )

originally I had the search_fields=('a','name') but that failed to search at 
all. My boss suggested that the documentation 'foreign_key__related_fieldname' 
should be replaced by 'a__id' and that seems to locate some rows, but the 
listing page doesn't display. I looked in vain for some simple examples, but 
cannot get this simple behaviour to work. What's the 'right' way to search by a 
foreign key?
-- 
Robin Becker

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to