django에서 새로운 기능입니다. 내 질문이 있다는 것입니다 : - syncdb오류 : - 하나 이상의 모델이 유효성을 검사하지 않았습니다.
ERROR: One or more models did not validate:
내 models.py
class practicalArea:
practical_area = models.CharField(max_length=25)
class Meta:
db_table = 'practical_area'
def __unicode__(self):
return self.practical_area
class Profile(models.Model):
auth_user_id = models.ForeignKey(User, related_name='userProfile')
address = models.TextField(blank=True)
state = models.CharField(max_length=20)
practical_area = models.ForeignKey('practicalArea', related_name='practical_Area')
company = models.CharField(max_length=40)
photo = models.CharField(max_length=250)
created_date = models.DateTimeField()
modify_date = models.DateTimeField()
class Meta:
db_table = 'adminPanal_profile'
def save(self):
if self.created_date == None:
self.created_date = datetime.now()
self.modify_date = datetime.now()
super(Profile, self).save()
내가 "practical_area = models.ForeignKey ('practicalArea'을 변경하는 경우
을 적용 할 때 (아래 설명) 내가 오류가 발생했습니다, related_name = 'practical_Area') "을"practical_area = models.ForeignKey (practicalArea, related_name = 'practical_Area') " 다음 내가 ERROR 가지고 :을AssertionError: ForeignKey() is invalid. First parameter to ForeignKey must be either a model, a model name, or the string 'self'
도와주세요!
죄송합니다 - 나는 또한 django.db 수입 모델에서'의 라이브러리를 가져 django.contrib.auth.models에서 이 practicalArea이 모델에서 – user3292290
상속한다 날짜 가져 오기 datetime'에서 사용자 를 가져 .모델. 그것은 당신의 문제를 해결해야합니다. –
감사합니다 @ KamilRykowski :) – user3292290