관리자 패널에 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의 내용을 삭제했으며 오류가 여전히 있습니다.
urls.py에'admin.autodiscover()'를 넣었습니까? –
예, 두 줄의 주석 처리를 제거했습니다. – dease
/admin /에게 귀하의 요청을 반복하여 마지막 역 추적 라인의 지역 주민을 조사하십시오. 어떤 함수가'processor' 변수에 저장되어 있습니까? 관리자 인터페이스가 아닌 문제처럼 보입니다. – werehuman