我的Django项目中安装了2个应用程序"aplikacja"
第一个名为:"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')
Run Code Online (Sandbox Code Playgroud)
第二个命名为:"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)
Run Code Online (Sandbox Code Playgroud)
我收到这样的错误:
userprofile.UserProfile.czas: (fields.E300) Field defines a relation with model 'Godzina', which is either not installed, or is abstract.
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我希望用户只能选择管理员放入应用程序"Godzina"的时间.例如,我定义时间为晚上19点,晚上20点,然后用户可以在UserProfile应用程序中选择这些值
有可能解决这个问题吗?