出於某種原因,這些類archive
和album
顯示所有的在Django管理面板領域,但image
沒有顯示時,我去到的圖像添加到圖像面板的album
場。如果我打開一個shell,它表明album
是image
的一個子集,它只是沒有出現在image
的管理界面(但它通過CLI)。爲什麼?Django的模型類缺少聯繫
class archive(models.Model):
name = models.CharField(max_length = 30)
archivedata = models.TextField(blank=True, help_text="Documentation for album/image.archivedata methodology is put here")
def __unicode__(self):
return self.name
class tag(models.Model):
archive = models.ForeignKey(archive)
tag = models.CharField(max_length=60)
def __unicode__(self):
return self.tag
class album(models.Model):
archive = models.ForeignKey(archive)
title = models.CharField(max_length=60)
tags = models.ManyToManyField(tag, blank=True, help_text="Searchable Keywords")
archivedata = models.TextField(blank=True, null=True, help_text="Data specific to particular archiving methods or processes can be stored here")
def __unicode__(self):
return self.title
class image(models.Model):
album = models.ForeignKey(album)
archive = models.ForeignKey(archive)
imagefile = models.ImageField(upload_to='ns/') #image.width/height
title = models.CharField(max_length=60, blank=True, help_text="Descriptive image title")
tags = models.ManyToManyField(tag, blank=True, help_text="Searchable Keywords")
更新:包括每個請求我的admin.py:
你的admin.py是什麼樣的? – rh0dium
我更新了我的問題以包含admin.py – mh00h