diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index b47c033..e5d61e9 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-10 19:22+0100\n" +"POT-Creation-Date: 2025-01-15 14:56+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -84,7 +84,7 @@ msgstr "Generiere Inhaltsverzeichnis" msgid "Page not available in %s" msgstr "Seite auf %s nicht vorhanden" -#: mpicms/base/mixins.py:94 mpicms/personal/wagtail_hooks.py:79 +#: mpicms/base/mixins.py:94 mpicms/personal/wagtail_hooks.py:97 msgid "Contacts" msgstr "Kontakte" @@ -93,7 +93,7 @@ msgid "Sidebar Content" msgstr "Inhalt der Seitenleiste" #: mpicms/base/models.py:46 mpicms/personal/models.py:68 -#: mpicms/personal/models.py:95 mpicms/publications/models.py:26 +#: mpicms/personal/models.py:120 mpicms/publications/models.py:26 #: venv0/lib/python3.7/site-packages/wagtailvideos/models.py:84 msgid "title" msgstr "Titel" @@ -235,70 +235,101 @@ msgstr "Neuigkeit" msgid "news entries" msgstr "Neuigkeiten" -#: mpicms/personal/models.py:25 mpicms/personal/models.py:31 -#: mpicms/publications/models.py:27 +#: mpicms/personal/models.py:25 mpicms/publications/models.py:27 msgid "groups" msgstr "Gruppen" -#: mpicms/personal/models.py:44 mpicms/personal/models.py:50 +#: mpicms/personal/models.py:31 +#, fuzzy +#| msgid "groups" +msgid "group" +msgstr "Gruppen" + +#: mpicms/personal/models.py:44 msgid "positions" msgstr "Positionen" -#: mpicms/personal/models.py:96 +#: mpicms/personal/models.py:50 +#, fuzzy +#| msgid "positions" +msgid "position" +msgstr "Positionen" + +#: mpicms/personal/models.py:83 +msgid "status" +msgstr "" + +#: mpicms/personal/models.py:97 +msgid "special function" +msgstr "" + +#: mpicms/personal/models.py:121 msgid "first name" msgstr "Vorname" -#: mpicms/personal/models.py:97 +#: mpicms/personal/models.py:122 msgid "last name" msgstr "Nachname" -#: mpicms/personal/models.py:98 +#: mpicms/personal/models.py:123 +msgid "academic_suffix" +msgstr "" + +#: mpicms/personal/models.py:124 msgid "email" msgstr "Email-Adresse" -#: mpicms/personal/models.py:99 +#: mpicms/personal/models.py:125 msgid "phone number" msgstr "Telefonnummer" -#: mpicms/personal/models.py:100 +#: mpicms/personal/models.py:126 msgid "room" msgstr "Raum" -#: mpicms/personal/models.py:101 +#: mpicms/personal/models.py:127 msgid "is active" msgstr "ist aktiv" -#: mpicms/personal/models.py:103 mpicms/personal/models.py:159 +#: mpicms/personal/models.py:129 mpicms/personal/models.py:191 msgid "priority" msgstr "Priorität" -#: mpicms/personal/models.py:104 +#: mpicms/personal/models.py:130 msgid "Priority from 0-999 to determine the sorting order." msgstr "Priorität von 0-999 zur Bestimmung der Reihenfolge." -#: mpicms/personal/models.py:156 +#: mpicms/personal/models.py:132 +msgid "special functions" +msgstr "" + +#: mpicms/personal/models.py:188 msgid "slug" msgstr "Kürzel" -#: mpicms/personal/models.py:157 +#: mpicms/personal/models.py:189 msgid "name" msgstr "Name" -#: mpicms/personal/models.py:160 +#: mpicms/personal/models.py:192 msgid "Priority from 0-99 to determine the sorting order." msgstr "Priorität von 0-99 zur Bestimmung der Reihenfolge." -#: mpicms/personal/wagtail_hooks.py:37 +#: mpicms/personal/models.py:220 +msgid "valid" +msgstr "" + +#: mpicms/personal/wagtail_hooks.py:40 msgid "Persons" msgstr "Personen" -#: mpicms/personal/wagtail_hooks.py:49 mpicms/personal/wagtail_hooks.py:66 +#: mpicms/personal/wagtail_hooks.py:52 mpicms/personal/wagtail_hooks.py:69 #: mpicms/templates/personal/list.html:46 #: mpicms/templates/wagtailusers/users/list.html:28 msgid "Groups" msgstr "Gruppen" -#: mpicms/personal/wagtail_hooks.py:54 mpicms/personal/wagtail_hooks.py:73 +#: mpicms/personal/wagtail_hooks.py:57 mpicms/personal/wagtail_hooks.py:76 #: mpicms/templates/personal/list.html:45 msgid "Positions" msgstr "Positionen" diff --git a/mpicms/personal/migrations/0027_auto_20250115_1509.py b/mpicms/personal/migrations/0027_auto_20250115_1509.py new file mode 100644 index 0000000..f3a266b --- /dev/null +++ b/mpicms/personal/migrations/0027_auto_20250115_1509.py @@ -0,0 +1,78 @@ +# Generated by Django 3.1.7 on 2025-01-15 14:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('personal', '0026_auto_20200813_1342'), + ] + + operations = [ + migrations.CreateModel( + name='SpecialFunction', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=50, verbose_name='special function')), + ('title_en', models.CharField(max_length=50, null=True, verbose_name='special function')), + ('title_de', models.CharField(max_length=50, null=True, verbose_name='special function')), + ], + ), + migrations.CreateModel( + name='Status', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=50, verbose_name='status')), + ('title_en', models.CharField(max_length=50, null=True, verbose_name='status')), + ('title_de', models.CharField(max_length=50, null=True, verbose_name='status')), + ], + options={ + 'verbose_name_plural': 'status', + }, + ), + migrations.AddField( + model_name='contact', + name='academic_suffix', + field=models.CharField(blank=True, max_length=50, verbose_name='academic_suffix'), + ), + migrations.AlterField( + model_name='contact', + name='title', + field=models.CharField(blank=True, max_length=15, verbose_name='title'), + ), + migrations.AlterField( + model_name='contactgroups', + name='group', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to='personal.group', verbose_name='group'), + ), + migrations.AlterField( + model_name='contactpositions', + name='position', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to='personal.position', verbose_name='position'), + ), + migrations.CreateModel( + name='WrittenConsent', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ref', models.CharField(max_length=10, unique=True, verbose_name='ID')), + ('comment', models.TextField(blank=True, verbose_name='comment')), + ('valid', models.BooleanField(default=True, verbose_name='valid')), + ('contacts', models.ManyToManyField(blank=True, to='personal.Contact')), + ], + options={ + 'ordering': ['ref'], + }, + ), + migrations.AddField( + model_name='contact', + name='special_functions', + field=models.ManyToManyField(blank=True, to='personal.SpecialFunction', verbose_name='special functions'), + ), + migrations.AddField( + model_name='contact', + name='status', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='personal.status'), + ), + ] diff --git a/mpicms/personal/models.py b/mpicms/personal/models.py index e7c8035..27d77ca 100644 --- a/mpicms/personal/models.py +++ b/mpicms/personal/models.py @@ -28,7 +28,7 @@ class ContactGroups(Orderable, models.Model): 'personal.Group', related_name='contacts', on_delete=models.CASCADE, - verbose_name=_('groups') + verbose_name=_('group') ) panels = [ @@ -47,7 +47,7 @@ class ContactPositions(Orderable, models.Model): 'personal.Position', related_name='contacts', on_delete=models.CASCADE, - verbose_name=_('positions') + verbose_name=_('position') ) panels = [ @@ -79,6 +79,31 @@ def __str__(self): return self.title +class Status(models.Model): + title = models.CharField(_("status"), max_length=50) + + panels = [ + FieldPanel('title') + ] + + def __str__(self): + return self.title + + class Meta: + verbose_name_plural = "status" + + +class SpecialFunction(models.Model): + title = models.CharField(_("special function"), max_length=50) + + panels = [ + FieldPanel('title') + ] + + def __str__(self): + return self.title + + @register_snippet class Contact(index.Indexed, ClusterableModel): """ @@ -92,9 +117,10 @@ class Contact(index.Indexed, ClusterableModel): to the database. https://github.com/wagtail/django-modelcluster """ - title = models.CharField(_("title"), max_length=5, blank=True) + title = models.CharField(_("title"), max_length=15, blank=True) first_name = models.CharField(_("first name"), max_length=50, blank=True) last_name = models.CharField(_("last name"), max_length=50, blank=True) + academic_suffix = models.CharField(_("academic_suffix"), max_length=50, blank=True) email = models.EmailField(_("email"), blank=True) phone = models.CharField(_("phone number"), blank=True, max_length=50) room = models.CharField(_("room"), max_length=50, blank=True) @@ -102,6 +128,8 @@ class Contact(index.Indexed, ClusterableModel): priority = models.PositiveSmallIntegerField( _("priority"), blank=True, default=0, validators=[MaxValueValidator(999)], help_text=_("Priority from 0-999 to determine the sorting order.")) + status = models.ForeignKey(Status, on_delete=models.SET_NULL, blank=True, null=True) + special_functions = models.ManyToManyField(SpecialFunction, verbose_name=_('special functions'), blank=True) objects = ContactManager() @@ -110,10 +138,14 @@ class Contact(index.Indexed, ClusterableModel): FieldPanel('title', classname=''), FieldPanel('first_name'), FieldPanel('last_name'), + FieldPanel('academic_suffix'), ], heading='Name'), + FieldPanel('status'), InlinePanel( 'positions', label="Positions", - panels=None), + panels=None + ), + FieldPanel('special_functions'), FieldPanel('email'), FieldPanel('phone'), FieldPanel('room'), @@ -180,3 +212,16 @@ class Meta: # noqa verbose_name = 'Group' verbose_name_plural = 'Groups' ordering = ['-priority'] + + +class WrittenConsent(models.Model): + ref = models.CharField("ID", max_length=10, unique=True) + comment = models.TextField("comment", blank=True) + valid = models.BooleanField(_("valid"), default=True) + contacts = models.ManyToManyField(Contact, blank=True) + + def __str__(self): + return "Written Consent #" + self.ref + " (" + ", ".join(str(c) for c in self.contacts.all()) + ")" + + class Meta: + ordering = ['ref'] diff --git a/mpicms/personal/translation.py b/mpicms/personal/translation.py index bf716aa..156b175 100644 --- a/mpicms/personal/translation.py +++ b/mpicms/personal/translation.py @@ -2,6 +2,8 @@ from modeltranslation.decorators import register from .models import Position, Group +from .models import Status +from .models import SpecialFunction @register(Position) @@ -16,3 +18,17 @@ class GroupTR(TranslationOptions): fields = ( 'name', ) + + +@register(Status) +class StatusTR(TranslationOptions): + fields = ( + 'title', + ) + + +@register(SpecialFunction) +class SpecialFunctionTR(TranslationOptions): + fields = ( + 'title', + ) diff --git a/mpicms/personal/wagtail_hooks.py b/mpicms/personal/wagtail_hooks.py index 0548aa9..8e3565b 100644 --- a/mpicms/personal/wagtail_hooks.py +++ b/mpicms/personal/wagtail_hooks.py @@ -6,6 +6,9 @@ from wagtail.contrib.modeladmin.views import EditView, InspectView, DeleteView, InstanceSpecificView from .models import Contact, Group, Position +from .models import Status +from .models import SpecialFunction +from .models import WrittenConsent class ContactInstanceView(InstanceSpecificView): @@ -75,13 +78,31 @@ class PositionAdmin(ModelAdmin): search_fields = ['title'] +class StatusAdmin(ModelAdmin): + model = Status + menu_icon = 'tag' + + +class SpecialFunctionAdmin(ModelAdmin): + model = SpecialFunction + menu_icon = 'tag' + + +class WrittenConsentAdmin(ModelAdmin): + model = WrittenConsent + menu_icon='doc-full' + + class ContactGroup(ModelAdminGroup): menu_label = _('Contacts') menu_icon = 'user' items = [ ContactAdmin, GroupAdmin, - PositionAdmin + PositionAdmin, + StatusAdmin, + SpecialFunctionAdmin, + WrittenConsentAdmin, ]