出于某种原因,这些类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