Django.contrib.admin.sites.AlreadyRegistered: Модель BookInstance уже зарегистрирована в приложении 'catalog'

По какой-то причине я не могу запустить свой webapp из-за этого кода, он показывает эту ошибку: django.contrib.admin.sites.AlreadyRegistered: может кто-нибудь помочь мне, что мне делать?

class BookInstance(models.Model):


 """Model representing a specific copy of a book (i.e. that can be borrowed from the library)."""

id = models.UUIDField(primary_key=True, default=uuid.uuid4, help_text='Unique ID for this particular book across whole library')
book = models.ForeignKey('Book', on_delete=models.RESTRICT, null=True)
imprint = models.CharField(max_length=200)
due_back = models.DateField(null=True, blank=True)
borrower = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)

LOAN_STATUS = (
    ('m', 'Maintenance'),
    ('o', 'On loan'),
    ('a', 'Available'),
    ('r', 'Reserved'),
)

status = models.CharField(
    max_length=1,
    choices=LOAN_STATUS,
    blank=True,
    default='m',
    help_text='Book availability',
)

class Meta:
    ordering = ['due_back']

def __str__(self):
    """String for representing the Model object."""
    return f'{self.id} ({self.book.title})'

@property
def is_overdue(self):
    if self.due_back and date.today() > self.due_back:
        return True
    return False
Вернуться на верх