0
장고 프로젝트에 문제가 있습니다. 파이썬 2.7, 아파치 2.2, MySQL 데이터베이스; 내가 관리자 패널에서 객체 항목을 만들 때 이 models.pyDjango atribute error
from django.db import models
from django.contrib import admin
class Item(models.Model):
name = models.CharField(max_length=150)
description = models.TextField()
class Meta:
ordering = ['name']
def __unicode__(self):
return self.name
def get_absolute_url(self):
return 'item_detail', None, {'object_id': self.id}
class Photo(models.Model):
item = models.ForeignKey('Item')
title = models.CharField(max_length=100)
image = models.ImageField(upload_to='photos')
caption = models.CharField(max_length=250, blank=True)
class Meta:
ordering = ['title']
def __unicode__(self):
return self.title
def get_absolute_url(self):
return 'photo_detail', None, {'object_id': self.id}
class PhotoInline(admin.StackedInline):
model = Photo
class ItemAdmin(admin.ModelAdmin):
inlines = [PhotoInline]
admin.site.register(Item, ItemAdmin)
admin.site.register(Photo)
의 코드는 나에게 오류가 난이 오류와 함께 무엇을해야
POST
Request URL: http://127.0.0.1/admin/item/item/add/
Django Version: 1.4.2
Exception Type: Warning
Exception Value:
'Photo' object has no attribute 'name'
Exception Location: C:\wamp\python27\lib\site-packages\MySQLdb\cursors.py in _warning_check, line 117
Python Executable: C:\wamp\bin\apache\apache2.2.22\bin\httpd.exe
Python Version: 2.7.0
Python Path:
['C:\\wamp\\python27\\lib\\site-packages\\setuptools-1.1.6-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\jaraco.develop-2.3-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\jaraco.windows-2.15-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\path.py-4.3-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\keyring-3.1-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\jaraco.util-8.5-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\six-1.4.1-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\ipython-1.1.0-py2.7.egg',
'C:\\wamp\\python27\\lib\\site-packages\\pyreadline-2.0-py2.7-win-amd64.egg',
'C:\\WINDOWS\\SYSTEM32\\python27.zip',
'C:\\wamp\\python27\\Lib',
'C:\\wamp\\python27\\DLLs',
'C:\\wamp\\python27\\Lib\\lib-tk',
'C:\\wamp\\bin\\apache\\apache2.2.22',
'C:\\wamp\\bin\\apache\\apache2.2.22\\bin',
'C:\\wamp\\python27',
'C:\\wamp\\python27\\lib\\site-packages',
'c:/DjangoProjects/photogallery/']
Server time: Thu, 24 Oct 2013 23:29:33 +0400
을 줄입니다입니까?
일부 변경을 수행하고 아파치를 다시 시작하지 않았을 수 있습니까? – oleg
전체 스택 추적입니까? – karthikr
'admin.py'를 게시 할 수 있습니까? –