Hello, guys!
Have 3 models in my app:
class State(models.Model):
name = models.CharField('state name', max_length=20)
usps_name = models.CharField('USPS 2 letters state codename',
max_length=2)
class City(models.Model):
name = models.CharField('City name', max_length=50)
state = models.ForeignKey(State)
class Club(models.Model):
name = models.CharField(max_length=50)
description = models.TextField()
address = models.CharField('Street address', max_length=100,
blank=True, null=True)
city = models.ForeignKey(City)
I wanna to see City and State fields in a Club change list, and do
some related stuff with them: sort, use filters, etc. Now I only could
to add fields to change list:
class Club(models.Model):
def city_name(self):
return self.city.name
city_name.short_description = 'City'
city_name.admin_order_field = 'city'
def state_name(self):
return self.city.state
state_name.short_description = 'State'
state_name.admin_order_field = 'city__state'
I can see them in the change list and can sort the data by clicking
columns' headers. But 'ordering', 'list_filter' and other properties
are unavailable.
What you advice me?
--
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.