【发布时间】:2015-04-21 23:51:53
【问题描述】:
我的 Django 项目“aplikacja”中安装了 2 个应用程序
第一个名为:“Godzina”
from django.db import models
class Godzina (models.Model):
GODZINA = (
('19', '19'),
('20', '20'),
('21', '21'),
)
godzina = models.CharField(max_length=6, choices=GODZINA, verbose_name='jezyk')
第二个命名为:“UserProfile”
from django.db import models
from django.contrib.auth.models import User
from godzina.models import Godzina
class UserProfile(models.Model):
czas = models.ForeignKey('Godzina')
user = models.OneToOneField(User)
我收到这样的错误:
userprofile.UserProfile.czas: (fields.E300) Field defines a relation with model 'Godzina', which is either not installed, or is abstract.
这是什么意思?我希望用户只能选择管理员在“Godzina”应用程序中输入的时间。例如,我定义了 19 pm、20 pm 的时间,然后用户可以在 UserProfile 应用程序中选择这些值
这个问题可以解决吗?
【问题讨论】:
标签: django python-2.7 django-models