The ManyToManyField fields of my model are not created in the database
I have created a project model.
For each project I would like to display all human and material resources assigned to the project.
Except that after creating a project through the form, I found that some fields of my model were not created in the database, as shown in the image below:
here join my model
class Projet(models.Model):
STATUS = (
(1, 'NON DÉBUTÉ'),
(2, 'EN COURS'),
(3, 'TERMINER'),
(4, 'ARCHIVER'),
)
name = models.CharField(max_length=100, default=None)
description = models.TextField(default=None)
start_date = models.DateField(default=timezone.now)
end_date = models.DateField(default=timezone.now)
chef_project = models.ForeignKey(
User,
on_delete=models.CASCADE,
related_name='chef_project',
default=None
)
conducteur_travaux = models.ForeignKey(
User,
on_delete=models.CASCADE,
related_name='conducteur_travaux',
default=None
)
list_intervenant = models.ManyToManyField(
User,
related_name='intervenant'
)
list_materiels = models.ManyToManyField(Materiels)
client = models.ForeignKey(
Client,
on_delete=models.CASCADE,
default=None
)
status = models.PositiveSmallIntegerField(
choices=STATUS,
default=1
)
budget = models.IntegerField(default=0)
pieces_jointes = models.FileField(
verbose_name='image',
upload_to='media/upload/documents',
null=True
)
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
event = Event(
title=self.name,
description=self.description,
start_time=self.start_date,
end_time=self.end_date
)
event.save()
""" def delete(self, *args, **kwargs):
super().save(*args, **kwargs)
Event.objects.filter(
title=self.name,
description=self.description
).delete() """
here join the image created in the database
as you can see, the fields: list_intervenant, list_materiels are not created in the database.
What do you think my mistake is?
Thank you in advance