2
Django raw_id_fields不按照我期望的方式顯示錶格,我是否做錯了什麼?我試圖用一個raw_id_fields部件如下編輯ForeignKey的領域:Django admin raw_id_fields表格顯示
#models.py
class OrderLine(models.Model):
product = ForeignKey('SternProduct')
class SternProduct(models.Model):
def __unicode__(self): return self.product_num
product_num = models.CharField(max_length=255)
#admin.py
#import and register stuff
class OrderLineAdmin(admin.ModelAdmin):
raw_id_fields=('product')
我得到預期的小文本框和放大鏡窗口小部件,但點擊放大鏡給了我這樣的: flickr.com/photos/28928816 @ N00/5244376512 /尺寸/ O /中/照片流/
(抱歉,不能張貼明顯超過一個超鏈接)
我想我應該得到的東西更接近變更列表頁面C/W列,過濾器和搜索字段。事實上,這顯然是what others get。
有關如何啓用更多功能小部件的任何想法?
請注意:('product')不是元組,它是一個字符串!要創建一個元組,您需要使用('product')或者'product', – 2011-01-26 17:34:58