0
我無法在django應用程序中登錄到管理面板。 它返回錯誤(列表在這裏:http://dpaste.com/1437248/)。Django管理返回TypeError
我admin.py:
from app.models import *
from django.contrib import admin
admin.site.register(Product, Product.Admin)
我的models.py(部分):
class Product(BaseModel):
company = models.ForeignKey(Company, null=True, blank=True)
title = models.CharField(max_length=128)
description = models.TextField()
category = models.ForeignKey(ProductCategory, null=True, blank=True)
price = models.DecimalField(max_digits=5,decimal_places=2)
image = models.ImageField(upload_to=product_upload_to)
thumb = models.ImageField(upload_to=thumb_upload_to)
def save(self, force_update=False, force_insert=False, thumb_size=(120,120)):
image = Image.open(self.image)
image.thumbnail(thumb_size, Image.ANTIALIAS)
temp_handle = StringIO()
image.save(temp_handle, 'png')
temp_handle.seek(0) # rewind the file
suf = SimpleUploadedFile(os.path.split(self.image.name)[-1],
temp_handle.read(),
content_type='image/png')
self.thumb.save(suf.name+'.png', suf, save=False)
super(Product, self).save(force_update, force_insert)
class Admin(admin.ModelAdmin):
list_display = ('title','price')
編輯: 現在我相信,這個錯誤不是由管理員造成的。 py/Admin類 - 我刪除了admin.py的內容,錯誤仍然存在。
你把'admin.autodiscover()'放到了你的urls.py中嗎? –
是的,我有兩條線都未註釋。 – dease
請將您的請求重複到/ admin /並查看最後一條回溯線的當地人。哪個函數存儲在變量'processor'中?看起來像問題不在管理界面。 – werehuman