2010-05-05 83 views
7

我試圖使用ModelAdmin.filter_horizo​​ntal和ModelAdmin.filter_vertical爲多對多場,而不是選擇多框,但我得到的是: Django管理的filter_horizo​​ntal(filter_vertical)不工作

我的模型:


class Title(models.Model): 
    #... 
    production_companies = models.ManyToManyField(Company, verbose_name="компании-производители") 
    #... 

我的管理員:


class TitleAdmin(admin.ModelAdmin): 
    prepopulated_fields = {"slug": ("original_name",)} 
    filter_horizontal = ("production_companies",) 
    radio_fields = {"state": admin.HORIZONTAL} 
    #... 

的Java腳本加載好了,我真的不明白髮生了什麼。 Django 1.1.1穩定。

回答

15

我終於找到了解決辦法。問題在於該字段的詳細名稱 - 它是str而不是unicode。轉向unicode幫助。

感謝:-)

+2

我需要幾個小時才能找到答案。 – vmassuchetto 2012-02-28 18:50:45

+0

模型的'verbose_name =「Catégorie」'變成'verbose_name = u「Catégorie」'。 1個字符修復,真棒! @negus,你是一個天才。我總是忘記在python中重複檢查帶有重音符號的字符串!這變得非常煩人。 – GabLeRoux 2015-02-01 06:45:17

相關問題