I have 2 apps installed in my Django Project "aplikacja"
The first one named: "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')
and the second named: "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)
I'm getting this error:
userprofile.UserProfile.czas: (fields.E300) Field defines a relation with model 'Godzina', which is either not installed, or is abstract.
What does this error mean? I would like to make it so the User can only pick such times as an administrator puts in the app "Godzina" For example I'm defining hours 19 pm, 20 pm and then the user can choose those values in the UserProfile app.
Is it possible to fix this problem?
You should add the app name to the related model name in the FK definition:
czas = models.ForeignKey('firstapp.Godzina')