Я новичок в django Я хочу создать приложение для бизнес-плана Я создаю 3 класса в моем файле моделей "models.py", когда я запускаю python manage.py мигрирует, он показывает мне следующие ошибки:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\core\management\__init__.py",
line 401, in execute_from_command_line
utility.execute()
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\core\management\__init__.py",
line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\core\management\base.py", line
328, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\core\management\base.py", line
369, in execute
output = self.handle(*args, **options)
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\core\management\base.py", line
83, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\hp\PycharmProjects\business\lib\site-
packages\django\core\management\commands\migrate.py", line 89, in handle
executor.loader.check_consistent_history(connection)
File "C:\Users\hp\PycharmProjects\business\lib\site-packages\django\db\migrations\loader.py", line
295, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied
before its dependency businessplan.0001_initial on database 'de
fault'.
это мой models.py: он содержит 4 класса Entrepreneur, Admin, User (abstract) и projet:
from django.db import models
from django.contrib.auth.models import *
#user
class CustomUser(AbstractUser):
user_type=((1,"admin"),(2,"staff"))
user_type=models.CharField(default=1,choices=user_type,max_length=10)
# Entrepreneur
class Entrepreneur(models.Model):
id_models= models.IntegerField(primary_key=True)
admin=models.OneToOneField(CustomUser,on_delete=models.CASCADE)
nom_et_prenom=models.CharField(max_length=50)
date_naissance=models.DateField()
adresse_entr=models.CharField(max_length=20)
telephone=models.IntegerField()
statut_social=(('ce','celébataire'),
('ma','marié'),
('di','divorcé'),
('ve','veuf'),
)
occupation=models.CharField(max_length=50)
niveau_scolaire=(
('pri','primaire'),
('sec','secondaire'),
('cap','certificat aptitude professionel'),
('btp','brevet technicien professionel'),
('bts','brevet technicien superieur'),
('lic','license'),
('mai','maitrise'),
('mas','mastere'),
('doc','doctorat'),
)
niveau_scolaire=models.CharField(default='ser',choices=niveau_scolaire,max_length=50)
annnee_exp=models.IntegerField()
email=models.CharField(max_length=255)
password=models.CharField(max_length=255)
#Projet
class Projet(models.Model):
id_models=models.IntegerField(primary_key=True)
admin = models.OneToOneField(CustomUser, on_delete=models.CASCADE)
nom_projet=models.CharField(max_length=30)
lieu_implantation=models.CharField(max_length=20)
type_projet=(
('ser','service'),
('com','commerce'),
('agr','agricuture'),
('ind','industrie'),
('IT','technologie information'),
('art','artisanat'),
('tor','tourisme'),
)
type_projet=models.CharField(default='ser',choices=type_projet,max_length=50)
produit=models.CharField(max_length=50)
id_promoteur=models.ForeignKey(Entrepreneur,on_delete=models.CASCADE)
#admin
class Admin(models.Model):
id_admin=models.AutoField(primary_key=True)
name=models.CharField(max_length=255)
email=models.CharField(max_length=255)
password=models.CharField(max_length=255)
objects=models.Manager()
сначала я запускаю команду makemigration, и все в порядке, но когда я запускаю команда migrate это не нормально