我写了这段代码:
admin.py
class MarketAdmin(admin.ModelAdmin):
list_display = ['Name', 'Location']
ordering = ['id', 'Name']
filter_horizontal = ["Weekend"]
admin.site.register(Market, MarketAdmin)
models.py
class Market(models.Model):
Name = models.CharField(max_length=50, unique=True, blank=False, verbose_name=u'Название')
Location = models.CharField(max_length=255, blank=False, verbose_name=u'Страна')
Weekend = models.ManyToManyField(Weekend, verbose_name=u'Выходной')
class Meta:
verbose_name = u'"Финансовый рынок"'
verbose_name_plural = u"Финансовые рынки"
def __unicode__(self):
return u"%s %s" % (self.Name, self.Location)
使用unicode作为详细名称并没有帮助在水平过滤器中重新创建周末字段。为什么会这样?
UPD: 在浏览器中给出了控制台:
[17:33:41.392] ReferenceError:没有定义grp [17:33:41.395] ReferenceError:没有定义grp [17:33:41.420] ReferenceError:django未定义
[17:33:41.524]未定义属性«box-sizing»。
[17:33:41.569] ReferenceError:未定义SelectFilter