structure du projet + docker, back: mise en place BD et apps, front: début de dev pour le header et mise en place du thème et css global (override des variables bootstrap)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from .contact_method import ContactMethod
|
||||
from .contact_person import ContactPerson
|
||||
from .m2m_prospect_selling_argument import M2M_ProspectSellingArgument
|
||||
from .m2m_prospect_type_selling_argument import M2M_ProspectTypeSellingArgument
|
||||
from .m2m_prospect_type_template import M2M_ProspectTypeTemplate
|
||||
from .m2m_template_step import M2M_TemplateStep
|
||||
from .prospect_contact_method import ProspectContactMethod
|
||||
from .prospect_step import ProspectStep
|
||||
from .prospect_type import ProspectType
|
||||
from .prospect import Prospect
|
||||
from .selling_argument import SellingArgument
|
||||
from .step_type import StepType
|
||||
from .template import Template
|
||||
|
||||
__all__ = [
|
||||
"ContactMethod",
|
||||
"ContactPerson",
|
||||
"M2M_ProspectSellingArgument",
|
||||
"M2M_ProspectTypeSellingArgument",
|
||||
"M2M_ProspectTypeTemplate",
|
||||
"M2M_TemplateStep",
|
||||
"ProspectContactMethod",
|
||||
"ProspectStep",
|
||||
"ProspectType",
|
||||
"Prospect",
|
||||
"SellingArgument",
|
||||
"StepType",
|
||||
"Template",
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
from gdpr.anonymizers import AnonymizationTemplate
|
||||
|
||||
|
||||
class ContactMethod(TrackableModel):
|
||||
"""
|
||||
Model representing a contact method.
|
||||
"""
|
||||
|
||||
name = models.CharField(verbose_name=_("nom"), max_length=100, blank=True)
|
||||
anonymization_template = models.CharField(
|
||||
max_length=32,
|
||||
choices=[(s.value, s.name) for s in AnonymizationTemplate],
|
||||
default=AnonymizationTemplate.REDACTED_ID.value,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Moyen de contact")
|
||||
verbose_name_plural = _("Moyens de contact")
|
||||
@@ -0,0 +1,25 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class ContactPerson(TrackableModel):
|
||||
"""
|
||||
Model representing a contact person linked to a prospect.
|
||||
"""
|
||||
|
||||
prospect = models.ForeignKey(
|
||||
"Prospect", verbose_name=_("prospect"), on_delete=models.PROTECT
|
||||
)
|
||||
first_name = models.CharField(verbose_name=_("prénom"), max_length=50, blank=True)
|
||||
last_name = models.CharField(verbose_name=_("nom"), max_length=50, blank=True)
|
||||
function = models.CharField(verbose_name=_("fonction"), max_length=100, blank=True)
|
||||
deciding = models.BooleanField(verbose_name=_("décideur"), default=False)
|
||||
preferred_contact_days_hours = models.TextField(
|
||||
verbose_name=_("Jours et heures de contact préférés"), blank=True, default=""
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Contact")
|
||||
verbose_name_plural = _("Contacts")
|
||||
@@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class M2M_ProspectSellingArgument(TrackableModel):
|
||||
"""
|
||||
Many to Many table for selling arguments and prospects.
|
||||
"""
|
||||
|
||||
selling_argument = models.ForeignKey("SellingArgument", on_delete=models.CASCADE)
|
||||
prospect = models.ForeignKey("Prospect", on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["selling_argument", "prospect"],
|
||||
name="unique_selling_argument_prospect",
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class M2M_ProspectTypeSellingArgument(TrackableModel):
|
||||
"""
|
||||
Many to Many table for selling arguments and prospect types.
|
||||
"""
|
||||
|
||||
selling_argument = models.ForeignKey("SellingArgument", on_delete=models.CASCADE)
|
||||
prospect_type = models.ForeignKey("ProspectType", on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["selling_argument", "prospect_type"],
|
||||
name="unique_selling_argument_prospect_type",
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class M2M_ProspectTypeTemplate(TrackableModel):
|
||||
"""
|
||||
Many to Many table for templates and prospect types.
|
||||
"""
|
||||
|
||||
template = models.ForeignKey("Template", on_delete=models.CASCADE)
|
||||
prospect_type = models.ForeignKey("ProspectType", on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["template", "prospect_type"],
|
||||
name="unique_template_prospect_type",
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,26 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class M2M_TemplateStep(TrackableModel):
|
||||
"""
|
||||
Many to Many table for templates and steps (identified by the step type).
|
||||
A template can have the same step type multiple times, but there can't be two entries with the same order for one template.
|
||||
"""
|
||||
|
||||
template = models.ForeignKey("Template", on_delete=models.CASCADE)
|
||||
step_type = models.ForeignKey("StepType", on_delete=models.CASCADE)
|
||||
order = models.IntegerField(verbose_name=_("ordre"))
|
||||
default_notes = models.TextField(
|
||||
verbose_name=_("notes par défaut"), blank=True, default=""
|
||||
)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["template", "order"],
|
||||
name="unique_template_order",
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,39 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.lead_explorer.models.brut_company import BrutCompany
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class Prospect(TrackableModel):
|
||||
"""
|
||||
Model representing a prospect.
|
||||
"""
|
||||
|
||||
brut_company = models.ForeignKey(
|
||||
BrutCompany,
|
||||
verbose_name=_("informations de la société"),
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
prospect_type = models.ForeignKey(
|
||||
"ProspectType",
|
||||
verbose_name=_("type de prospect"),
|
||||
on_delete=models.PROTECT,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
selling_arguments = models.ManyToManyField(
|
||||
"SellingArgument",
|
||||
verbose_name=_("arguments de vente"),
|
||||
blank=True,
|
||||
through="M2M_ProspectSellingArgument",
|
||||
)
|
||||
decision_making = models.TextField(
|
||||
verbose_name=_("prise de décision"), blank=True, default=""
|
||||
)
|
||||
decided = models.BooleanField(verbose_name=_("décidé"), default=False)
|
||||
decided_at = models.DateTimeField(_("a décidé le"), blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Prospect")
|
||||
verbose_name_plural = _("Prospects")
|
||||
@@ -0,0 +1,56 @@
|
||||
from django.db import models
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class ProspectContactMethod(TrackableModel):
|
||||
prospect = models.ForeignKey(
|
||||
"Prospect",
|
||||
verbose_name=_("prospect"),
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
contact_person = models.ForeignKey(
|
||||
"ContactPerson",
|
||||
verbose_name=_("contact"),
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
contact_method = models.ForeignKey(
|
||||
"ContactMethod", verbose_name=_("moyen de contact"), on_delete=models.PROTECT
|
||||
)
|
||||
label = models.CharField(verbose_name=_("label"), max_length=100, blank=True)
|
||||
value = models.CharField(verbose_name=_("valeur"), max_length=255)
|
||||
preferred = models.BooleanField(default=False)
|
||||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
if bool(self.prospect) == bool(self.contact_person):
|
||||
raise ValidationError(
|
||||
_("Renseigne soit un prospect soit un contact (exactement un).")
|
||||
)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""Validation before saving"""
|
||||
self.full_clean()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Moyen de contact")
|
||||
verbose_name_plural = _("Moyens de contact")
|
||||
constraints = [
|
||||
models.CheckConstraint(
|
||||
name="%(app_label)s_%(class)s_exactly_one_owner",
|
||||
condition=(
|
||||
models.Q(prospect__isnull=False, contact_person__isnull=True)
|
||||
| models.Q(prospect__isnull=True, contact_person__isnull=False)
|
||||
),
|
||||
violation_error_message=_(
|
||||
"Un moyen de contact doit être lié soit à un prospect, soit à un contact, mais pas les deux."
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,54 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class ProspectStep(TrackableModel):
|
||||
"""
|
||||
Model representing the prospection steps for a prospect.
|
||||
"""
|
||||
|
||||
source_template_step = models.ForeignKey(
|
||||
"M2M_TemplateStep",
|
||||
verbose_name=_("étape source"),
|
||||
null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
prospect = models.ForeignKey(
|
||||
"Prospect",
|
||||
verbose_name=_("prospect"),
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
contact_person = models.ForeignKey(
|
||||
"ContactPerson",
|
||||
verbose_name=_("contact"),
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
contact_method = models.ForeignKey(
|
||||
"ContactMethod",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
step_type = models.ForeignKey(
|
||||
"StepType",
|
||||
on_delete=models.PROTECT,
|
||||
)
|
||||
order = models.PositiveIntegerField()
|
||||
notes = models.TextField(blank=True)
|
||||
done = models.BooleanField(default=False)
|
||||
done_datetime = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Étape de prospection du prospect")
|
||||
verbose_name_plural = _("Étapes de prospection du prospect")
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=["prospect", "order"],
|
||||
name="uniq_prospect_step_order",
|
||||
),
|
||||
]
|
||||
ordering = ["prospect_id", "order"]
|
||||
@@ -0,0 +1,30 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class ProspectType(TrackableModel):
|
||||
"""
|
||||
Model representing a prospect type.
|
||||
"""
|
||||
|
||||
name = models.CharField(verbose_name=_("nom"), max_length=100, blank=True)
|
||||
selling_arguments = models.ManyToManyField(
|
||||
"SellingArgument",
|
||||
verbose_name=_("arguments de vente"),
|
||||
blank=True,
|
||||
related_name="prospect_types",
|
||||
through="M2M_ProspectTypeSellingArgument",
|
||||
)
|
||||
templates = models.ManyToManyField(
|
||||
"Template",
|
||||
verbose_name=_("modèles de prospection"),
|
||||
blank=True,
|
||||
related_name="prospect_types",
|
||||
through="M2M_ProspectTypeTemplate",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Type de prospect")
|
||||
verbose_name_plural = _("Types de prospects")
|
||||
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class SellingArgument(TrackableModel):
|
||||
"""
|
||||
Model representing a selling argument.
|
||||
"""
|
||||
|
||||
name = models.CharField(verbose_name=_("nom"), max_length=100, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Argument de vente")
|
||||
verbose_name_plural = _("Arguments de vente")
|
||||
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class StepType(TrackableModel):
|
||||
"""
|
||||
Model representing a prospection step type
|
||||
"""
|
||||
|
||||
name = models.CharField(verbose_name=_("nom"), max_length=150)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Type d'étape de prospection")
|
||||
verbose_name_plural = _("Types d'étape de prospection")
|
||||
@@ -0,0 +1,23 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.core.models.trackable_model import TrackableModel
|
||||
|
||||
|
||||
class Template(TrackableModel):
|
||||
"""
|
||||
Model representing a prospection template
|
||||
"""
|
||||
|
||||
name = models.CharField(verbose_name=_("nom"), max_length=150)
|
||||
steps = models.ManyToManyField(
|
||||
"StepType",
|
||||
verbose_name=_("étapes de prospection"),
|
||||
blank=True,
|
||||
related_name="templates",
|
||||
through="M2M_TemplateStep",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Modèle de prospection")
|
||||
verbose_name_plural = _("Modèles de prospection")
|
||||
Reference in New Issue
Block a user