如何用字母数字排序django list过滤器

时间:2016-10-03 14:53:16

标签: python django django-admin

我使用了默认的django过滤器,但它没有通过排序显示记录,即字母数字 以下是我的代码

class VoteAdminModel(admin.ModelAdmin):
    list_filter = ('business__poll__town__parent')

模型

class Business(models.Model):
    poll = models.ForeignKey('Poll')
    business_name = models.CharField(max_length=256, blank=True,null=True)

class Poll(models.Model):
    town = models.ForeignKey('Town', verbose_name="Survey")
    category = models.ForeignKey(Category)

class Vote(models.Model):
    business = models.ForeignKey(Business)
    vote_year = models.IntegerField(verbose_name="Year")
    gender = models.CharField(max_length=10)

class Town(models.Model):
    town_name = models.CharField(max_length=256, verbose_name="Survey")
    parent = models.ForeignKey('self', db_column='parent', blank=True, null=True, verbose_name="Survey")

enter image description here

0 个答案:

没有答案