我正在尝试将模块迁移到PostgresSQL,但是当我收到错误消息时,给我打电话的唯一键“ auth_permission_content_type_id_codename_01ab375a_uniq”是重复的。 密钥(content_type_id,代号)=(1,view_arrets)存在。 该代码以某种方式创建了重复视图。 我的模块是:
from django.db import models
from django.urls import reverse
class ProfilsHoraires(models.Model):
P_id = models.AutoField(primary_key=True)
id_profil = models.CharField(unique=True,max_length=120)
d_p_1 = models.TimeField()
f_p_1 = models.TimeField()
d_p_2 = models.TimeField()
f_p_2 = models.TimeField()
class Meta:
db_table = 'profilsHoraires'
ordering = ['P_id']
def get_absolute_url(self):
return reverse("profiles-edit", kwargs={"P_id": self.P_id})
class categorie(models.Model):
Categorie = models.CharField(primary_key=True,max_length=20, blank=True)
class Meta:
db_table = 'categorie'
ordering = ['Categorie']
def get_absolute_url(self):
return reverse("categorie-edit", kwargs={"id": self.Categorie})
class Destination(models.Model):
destinationNom=models.CharField(primary_key=True,max_length=90, blank=True)
class Meta:
db_table = 'disination'
ordering = ['destinationNom']
def get_absolute_url(self):
return reverse("destination-edit", kwargs={"id": self.destinationNom})
class Collaborateurs(models.Model):
mle = models.AutoField(primary_key=True)
nom = models.CharField(max_length=90, blank=True, null=True)
prenom = models.CharField(max_length=90, blank=True, null=True)
address = models.TextField(blank=True, null=True)
latitude = models.FloatField(blank=True, null=True)
longtitude = models.FloatField(blank=True, null=True)
libele_dest = models.ForeignKey(Destination, on_delete=models.SET_NULL, null=True)
profil = models.ForeignKey(ProfilsHoraires, on_delete=models.SET_NULL, null=True)
class Meta:
db_table = 'collaborateurs'
ordering = ['mle']
def __unicode__(self):
return self.title
def get_absolute_url(self):
return reverse("collabs-edit", kwargs={"mle": self.mle})
class Vehicules(models.Model):
V_id = models.AutoField(primary_key=True)
allocation= models.FloatField(null=False)
capacite = models.IntegerField(null=False)
type = models.CharField(max_length=20, blank=True, null=False)
class Meta:
db_table = 'vehicules'
def __unicode__(self):
return self.type
def get_absolute_url(self):
return reverse("vehicules-edit", kwargs={"V_id": self.V_id})
class LieuxAffet(models.Model):
id_lieu = models.AutoField(primary_key=True)
id_ville = models.IntegerField(null=True)
libelle_lieu = models.TextField(null=True)
latitude = models.FloatField(null=True)
longtitude = models.FloatField(null=True)
libelle_dest = models.ForeignKey(Destination, on_delete=models.SET_NULL, null=True)
class Meta:
db_table = 'lieux_affet'
def get_absolute_url(self):
return reverse("lieux-edit", kwargs={"id_lieu": self.id_lieu})
class Arrets(models.Model):
id_arret = models.IntegerField(primary_key=True)
id_lieu_affet = models.IntegerField(null=True)
id_dest = models.IntegerField(null=True)
libelle_arret = models.TextField(null=True)
latitude = models.FloatField(null=True)
longtitude = models.FloatField(null=True)
id_suiv = models.IntegerField(null=True)
class Meta:
db_table = 'Arrets'
def get_absolute_url(self):
return reverse("arrtes-edit", kwargs={"id_arret": self.id_arret})