diff --git a/lemarche/companies/admin.py b/lemarche/companies/admin.py index 05372f155..40b98def7 100644 --- a/lemarche/companies/admin.py +++ b/lemarche/companies/admin.py @@ -66,8 +66,8 @@ class CompanyAdmin(admin.ModelAdmin, DynamicArrayMixin): }, ), ("Logo", {"fields": ("logo_url", "logo_url_display")}), - ("Utilisateurs", {"fields": ("user_count_annotated_with_link",)}), - ("Besoins", {"fields": ("user_tender_count_annotated_with_link",)}), + ("LinkedIn", {"fields": ("linkedin_buyer_count",)}), + ("Impact", {"fields": ("user_count_annotated_with_link", "user_tender_count_annotated_with_link")}), ("Dates", {"fields": ("created_at", "updated_at")}), ) diff --git a/lemarche/companies/migrations/0005_company_linkedin_buyer_count.py b/lemarche/companies/migrations/0005_company_linkedin_buyer_count.py new file mode 100644 index 000000000..75e035dea --- /dev/null +++ b/lemarche/companies/migrations/0005_company_linkedin_buyer_count.py @@ -0,0 +1,35 @@ +# Generated by Django 4.2.9 on 2024-03-22 08:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("companies", "0004_company_user_tender_count"), + ] + + operations = [ + migrations.AddField( + model_name="company", + name="linkedin_buyer_count", + field=models.IntegerField( + default=0, help_text="Champ renseigné par un ADMIN", verbose_name="Nombre d'acheteurs sur LinkedIn" + ), + ), + migrations.AlterField( + model_name="company", + name="user_count", + field=models.IntegerField( + default=0, help_text="Champ recalculé à intervalles réguliers", verbose_name="Nombre d'utilisateurs" + ), + ), + migrations.AlterField( + model_name="company", + name="user_tender_count", + field=models.IntegerField( + default=0, + help_text="Champ recalculé à intervalles réguliers", + verbose_name="Nombre de besoins déposés par les utilisateurs", + ), + ), + ] diff --git a/lemarche/companies/models.py b/lemarche/companies/models.py index 39313e77a..4323939c6 100644 --- a/lemarche/companies/models.py +++ b/lemarche/companies/models.py @@ -4,6 +4,8 @@ from django.utils import timezone from django_better_admin_arrayfield.models.fields import ArrayField +from lemarche.utils.constants import ADMIN_FIELD_HELP_TEXT, RECALCULATED_FIELD_HELP_TEXT + class CompanyQuerySet(models.QuerySet): def has_user(self): @@ -39,8 +41,13 @@ class Company(models.Model): ) # stats - user_count = models.IntegerField("Nombre d'utilisateurs", default=0) - user_tender_count = models.IntegerField("Nombre de besoins déposés par les utilisateurs", default=0) + linkedin_buyer_count = models.IntegerField( + "Nombre d'acheteurs sur LinkedIn", help_text=ADMIN_FIELD_HELP_TEXT, default=0 + ) + user_count = models.IntegerField("Nombre d'utilisateurs", help_text=RECALCULATED_FIELD_HELP_TEXT, default=0) + user_tender_count = models.IntegerField( + "Nombre de besoins déposés par les utilisateurs", help_text=RECALCULATED_FIELD_HELP_TEXT, default=0 + ) created_at = models.DateTimeField(verbose_name="Date de création", default=timezone.now) updated_at = models.DateTimeField(verbose_name="Date de modification", auto_now=True)