From 12a36c8b30ddf24d736303cb00a80060e6d3caed Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Wed, 9 Oct 2024 11:07:08 +0200 Subject: [PATCH] add information harvest source for contact persons --- scipost_django/organizations/forms.py | 1 + .../0024_contactperson_info_source.py | 17 +++++++++++++++++ scipost_django/organizations/models.py | 1 + .../organizations/_organization_card.html | 2 ++ 4 files changed, 21 insertions(+) create mode 100644 scipost_django/organizations/migrations/0024_contactperson_info_source.py diff --git a/scipost_django/organizations/forms.py b/scipost_django/organizations/forms.py index cd4681405..bb618d15c 100644 --- a/scipost_django/organizations/forms.py +++ b/scipost_django/organizations/forms.py @@ -167,6 +167,7 @@ class ContactPersonForm(forms.ModelForm): fields = "__all__" widgets = { "date_deprecated": forms.DateInput(attrs={"type": "date"}), + "info_source": forms.Textarea(attrs={"rows": 2}), } def clean(self): diff --git a/scipost_django/organizations/migrations/0024_contactperson_info_source.py b/scipost_django/organizations/migrations/0024_contactperson_info_source.py new file mode 100644 index 000000000..de00c0962 --- /dev/null +++ b/scipost_django/organizations/migrations/0024_contactperson_info_source.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.15 on 2024-10-09 09:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("organizations", "0023_alter_contactperson_role"), + ] + + operations = [ + migrations.AddField( + model_name="contactperson", + name="info_source", + field=models.TextField(blank=True, verbose_name="Information source"), + ), + ] diff --git a/scipost_django/organizations/models.py b/scipost_django/organizations/models.py index f2b9295cd..b6054472f 100644 --- a/scipost_django/organizations/models.py +++ b/scipost_django/organizations/models.py @@ -710,6 +710,7 @@ class ContactPerson(models.Model): last_name = models.CharField(max_length=64) email = models.EmailField() role = models.CharField(max_length=128, blank=True, null=True) + info_source = models.TextField(blank=True, verbose_name="Information source") status = models.CharField( max_length=16, choices=STATUS_CHOICES, default=STATUS_UNKNOWN ) diff --git a/scipost_django/organizations/templates/organizations/_organization_card.html b/scipost_django/organizations/templates/organizations/_organization_card.html index 00f9598b7..1f41b9c31 100644 --- a/scipost_django/organizations/templates/organizations/_organization_card.html +++ b/scipost_django/organizations/templates/organizations/_organization_card.html @@ -773,6 +773,7 @@ <th>Name</th> <th>Email</th> <th>Role</th> + <th>Source</th> <th>Status</th> {% if perms.scipost.can_manage_organizations or "can_view_org_contacts" in user_org_perms %} @@ -785,6 +786,7 @@ <td>{{ contactperson }}</td> <td>{{ contactperson.email }}</td> <td>{{ contactperson.role }}</td> + <td>{{ contactperson.info_source }}</td> <td>{{ contactperson.get_status_display }} {% if contactperson.status == 'deprecated' %} <div class="text-muted">{{ contactperson.date_deprecated|date:"Y-m-d" }}</div> -- GitLab