csrs.Notification.user: (fields.E300) Field defines a relation with model 'User', which is either not installed, or is abstract.
csrs.Notification.user: (fields.E307) The field csrs.Notification.user was declared with a lazy reference to 'csrs.user', but app 'csrs' doesn't provide model 'user'.
我试图重新格式化它,但是其他方式对我来说没有意义。这是以下代码中的实际UML:https://imgur.com/a/Bhdh8ZE,这是Django模型:
class Notification(models.Model):
send_date = models.DateField(default=None)
text = models.CharField(max_length=511, default="")
user = models.ForeignKey(
'User',
on_delete=models.CASCADE,
default=None
)
class User(models.Model):
first_name = models.CharField(max_length=31, default="")
last_name = models.CharField(max_length=31, default="")
class Meta:
abstract = True
class SpecialUser(User):
pass
class SpecialUser2(User):
pass