Are there any plans to make list_display support stuff like artist__hometown, too? I've been missing this one a lot because the helper method approach is both slow and doesn't allow for sorting/filtering/searching etc, besides cluttering up the models with code that shouldn't be there.
Erik On 25.08.2008, at 19:18, Norman Harman wrote: > > Matt Berg wrote: >> I apologize, I realize this is probably documented somewhere. >> >> Say I have 2 models. >> >> Artist and Album >> >> Album has a foreign key to Artist. >> >> I want to do a list_display of Albums something like this... >> >> list_display = ('album','release_date','artist') >> >> This works fine and displays the info under the key for Artist. What >> I would like to do is access some of the other attributes of Artist. >> Trying artist.hometown and artist[hometown] doesn't work. > > One way to do this is to create helper functions. > > def _get_artist_hometown(self): > return self.artist.hometown > > > list_display = ('album','release_date',_get_artist_hometown) > > There're different options see > http://www.djangoproject.com/documentation/admin/#list-display > > -- > Norman J. Harman Jr. > Senior Web Specialist, Austin American-Statesman > ___________________________________________________________________________ > It's August! Keep your cool with the Statesman. Check out our hot > deals in print and online for back-to-school savings and more! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---