Hi there,
I'm very new to both Python and Django, so please pardon my ignorance
Here's what I'd like to do...
I've two models, one foriegnKey'ed to the other.
in models.py:
class Market(models.model):
name = models.CharField(max_length=55)
class Alias(models.model):
market_id = models.ForeignKey(Market)
alias = models.CharField(max_length=255)
uripatern = models.CharField(max_length=255)
in admin.py:
class AliasAdmin(admin.ModelAdmin):
list_display = ('market_name', 'alias', 'uripatern')
list_filter = ['market_id']
search_fields = ['alias', 'uripatern', 'market_id__name']
So as you can see, I'd like to include the Market.name field rather
than the market_id. I'd also like to have the search on aliases also
look on the Market.name
I've tried to add a function in the class Alias:
def market_name(self):
return self.market_id__name
But this just shows "None" in the admin screen for Aliases.
Thank you for your time and any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---