diff --git a/djangoldp_tzcld/admin.py b/djangoldp_tzcld/admin.py index 77fcef4fab358545793fe7121c6a168a352d270d..23a6423a7733c3b0cd0068853d5c29838ff57625 100644 --- a/djangoldp_tzcld/admin.py +++ b/djangoldp_tzcld/admin.py @@ -2,7 +2,48 @@ from django.contrib import admin from djangoldp.admin import DjangoLDPAdmin from djangoldp.models import Model #from djangoldp_tzcld.models import TzcldProfile, TzcldCommunity, TzcldTerritoriesKind, TzcldProfileOrganisation, TzcldProfileEvent, TzcldProfileRegion -from djangoldp_tzcld.models import TzcldProfile, TzcldCommunity, TzcldTerritoriesKind +from djangoldp_tzcld.models import TzcldProfile, TzcldCommunity, TzcldTerritoriesKind, TzcldCommunityFollowedPointPart, TzcldCommunityFollowedPoint, TzcldCommunityEvaluationPointPart, TzcldCommunityEvaluationPoint, TzcldTerritoryRegion, TzcldProfileJob, TzcldTerritoryLocation + + +# Register inline locations to territory community on TzcldCommunity +class TzcldTerritoryLocationInline(admin.TabularInline): + model = TzcldTerritoryLocation + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + extra = 0 + + +# Register inline jobs to user profile on TzcldProfile +class TzcldProfileJobInline(admin.TabularInline): + model = TzcldProfileJob + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + extra = 0 + +@admin.register(TzcldProfile) +class TzcldProfileAdmin(DjangoLDPAdmin): + inlines = [TzcldProfileJobInline] + + +# Register inline points to parts on TzcldCommunityFollowed +class TzcldCommunityFollowedPointInline(admin.TabularInline): + model = TzcldCommunityFollowedPoint + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + extra = 0 + +@admin.register(TzcldCommunityFollowedPointPart) +class TzcldCommunityFollowedPointPartAdmin(DjangoLDPAdmin): + inlines = [TzcldCommunityFollowedPointInline] + + +# Register inline points to parts on TzcldCommunityEvaluation +class TzcldCommunityEvaluationPointInline(admin.TabularInline): + model = TzcldCommunityEvaluationPoint + exclude = ('urlid', 'is_backlink', 'allow_create_backlink') + extra = 0 + +@admin.register(TzcldCommunityEvaluationPointPart) +class TTzcldCommunityEvaluationPointPartAdmin(DjangoLDPAdmin): + inlines = [TzcldCommunityEvaluationPointInline] + class TzcldCommunityInline(admin.StackedInline): @@ -13,6 +54,7 @@ class TzcldCommunityInline(admin.StackedInline): class TzcldCommunityAdmin(DjangoLDPAdmin): list_display = ('community', 'urlid') + inlines = [TzcldTerritoryLocationInline] exclude = ('urlid', 'slug', 'is_backlink', 'allow_create_backlink') search_fields = ['urlid', 'community', 'name'] ordering = ['community'] @@ -58,6 +100,7 @@ class TzcldGenericAdmin(DjangoLDPAdmin): #admin.site.register(TzcldProfile, TzcldProfileAdmin) admin.site.register(TzcldCommunity, TzcldCommunityAdmin) admin.site.register(TzcldTerritoriesKind, TzcldGenericAdmin) +admin.site.register(TzcldTerritoryRegion, TzcldGenericAdmin) #admin.site.register(TzcldProfileOrganisation, TzcldGenericAdmin) #admin.site.register(TzcldProfileEvent, TzcldGenericAdmin) #admin.site.register(TzcldProfileRegion, TzcldGenericAdmin) diff --git a/djangoldp_tzcld/migrations/0050_auto_20230923_1422.py b/djangoldp_tzcld/migrations/0050_auto_20230923_1422.py new file mode 100644 index 0000000000000000000000000000000000000000..75d8c6d1c6c55d8e5e282f1a2c12f60d855b1f82 --- /dev/null +++ b/djangoldp_tzcld/migrations/0050_auto_20230923_1422.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.28 on 2023-09-23 12:22 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0049_tzcldsharednote_date'), + ] + + operations = [ + migrations.AlterField( + model_name='tzcldcommunityevaluationpoint', + name='part', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='part_points', to='djangoldp_tzcld.TzcldCommunityEvaluationPointPart'), + ), + migrations.AlterField( + model_name='tzcldcommunityevaluationpointanswer', + name='evaluation_point', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='evaluation_point_answer', to='djangoldp_tzcld.TzcldCommunityEvaluationPoint'), + ), + migrations.AlterField( + model_name='tzcldcommunityfollowedpoint', + name='part', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='followed_part_points', to='djangoldp_tzcld.TzcldCommunityFollowedPointPart'), + ), + migrations.AlterField( + model_name='tzcldcommunityfollowedpointanswer', + name='followed_point', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='followed_point_answer', to='djangoldp_tzcld.TzcldCommunityFollowedPoint'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0051_auto_20231006_1244.py b/djangoldp_tzcld/migrations/0051_auto_20231006_1244.py new file mode 100644 index 0000000000000000000000000000000000000000..f6f9db1f7a091725101add47af5caa55d51c1648 --- /dev/null +++ b/djangoldp_tzcld/migrations/0051_auto_20231006_1244.py @@ -0,0 +1,32 @@ +# Generated by Django 2.2.28 on 2023-10-06 10:44 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0050_auto_20230923_1422'), + ] + + operations = [ + migrations.RemoveField( + model_name='tzcldterritorysharedfile', + name='community', + ), + migrations.RemoveField( + model_name='tzcldterritorysharedfile', + name='visible', + ), + migrations.AddField( + model_name='tzcldterritorysharedfile', + name='communityAdmins', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_admins_community_shared_files', to='djangoldp_tzcld.TzcldCommunityIdentity'), + ), + migrations.AddField( + model_name='tzcldterritorysharedfile', + name='communityReferents', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_referents_community_shared_files', to='djangoldp_tzcld.TzcldTerritorySynthesisFollowed'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0052_auto_20231006_1250.py b/djangoldp_tzcld/migrations/0052_auto_20231006_1250.py new file mode 100644 index 0000000000000000000000000000000000000000..9c0b4c9f3ea44b15bb2164b21925a3107e5e1d2a --- /dev/null +++ b/djangoldp_tzcld/migrations/0052_auto_20231006_1250.py @@ -0,0 +1,32 @@ +# Generated by Django 2.2.28 on 2023-10-06 10:50 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0051_auto_20231006_1244'), + ] + + operations = [ + migrations.RemoveField( + model_name='tzcldsharednote', + name='community', + ), + migrations.RemoveField( + model_name='tzcldsharednote', + name='visible', + ), + migrations.AddField( + model_name='tzcldsharednote', + name='communityAdmins', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_admins_community_shared_notes', to='djangoldp_tzcld.TzcldCommunityIdentity'), + ), + migrations.AddField( + model_name='tzcldsharednote', + name='communityReferents', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_referents_community_shared_notes', to='djangoldp_tzcld.TzcldTerritorySynthesisFollowed'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py b/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py new file mode 100644 index 0000000000000000000000000000000000000000..bc6c82dd8c623cebc22e1c9499dea0b3375936e3 --- /dev/null +++ b/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py @@ -0,0 +1,52 @@ +# Generated by Django 2.2.28 on 2023-10-06 11:00 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import djangoldp.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_conversation', '0007_auto_20200926_0911'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('djangoldp_tzcld', '0052_auto_20231006_1250'), + ] + + operations = [ + migrations.CreateModel( + name='TzcldTerritorySharedNote', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('urlid', djangoldp.fields.LDPUrlField(blank=True, null=True, unique=True)), + ('is_backlink', models.BooleanField(default=False, help_text='set automatically to indicate the Model is a backlink')), + ('allow_create_backlink', models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save')), + ('longdesc', models.TextField(blank=True, null=True)), + ('date', models.DateField(auto_now=True, verbose_name='Date')), + ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ('communityAdmins', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_admins_community_shared_notes', to='djangoldp_tzcld.TzcldCommunityIdentity')), + ('communityReferents', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_referents_community_shared_notes', to='djangoldp_tzcld.TzcldTerritorySynthesisFollowed')), + ('conversations', models.ManyToManyField(blank=True, related_name='tzcld_shared_notes', to='djangoldp_conversation.Conversation')), + ], + options={ + 'verbose_name': 'TZCLD Territory Shared Note', + 'verbose_name_plural': 'TZCLD Territories Shared Notes', + 'abstract': False, + 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], + 'rdf_type': 'tzcld:territorySharedNote', + 'auto_author': 'author', + 'container_path': 'tzcld-territory-shared-notes/', + 'serializer_fields': ['@id', 'author', 'longdesc', 'communityAdmins', 'communityReferents', 'conversations', 'date'], + 'nested_fields': ['author', 'communityAdmins', 'communityReferents', 'conversations'], + 'depth': 0, + 'anonymous_perms': [], + 'authenticated_perms': ['view', 'add'], + 'owner_perms': ['inherit', 'change', 'delete'], + 'superuser_perms': ['inherit'], + }, + ), + migrations.DeleteModel( + name='TzcldSharedNote', + ), + ] diff --git a/djangoldp_tzcld/migrations/0054_tzcldcommunityidentity_conversations.py b/djangoldp_tzcld/migrations/0054_tzcldcommunityidentity_conversations.py new file mode 100644 index 0000000000000000000000000000000000000000..9c7f153f330abe56973c5d20c224c58c43875374 --- /dev/null +++ b/djangoldp_tzcld/migrations/0054_tzcldcommunityidentity_conversations.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.28 on 2023-10-06 11:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_conversation', '0007_auto_20200926_0911'), + ('djangoldp_tzcld', '0053_auto_20231006_1300'), + ] + + operations = [ + migrations.AddField( + model_name='tzcldcommunityidentity', + name='conversations', + field=models.ManyToManyField(blank=True, related_name='tzcld_community_identity', to='djangoldp_conversation.Conversation'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0055_auto_20231006_1539.py b/djangoldp_tzcld/migrations/0055_auto_20231006_1539.py new file mode 100644 index 0000000000000000000000000000000000000000..5118bd3d32f8caecf9da969b50ee1f5d9dd705fb --- /dev/null +++ b/djangoldp_tzcld/migrations/0055_auto_20231006_1539.py @@ -0,0 +1,34 @@ +# Generated by Django 2.2.28 on 2023-10-06 13:39 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0054_tzcldcommunityidentity_conversations'), + ] + + operations = [ + migrations.AlterField( + model_name='tzcldterritorysharedfile', + name='communityAdmins', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_admins_community_shared_files', to='djangoldp_tzcld.TzcldCommunityIdentity'), + ), + migrations.AlterField( + model_name='tzcldterritorysharedfile', + name='communityReferents', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_referents_community_shared_files', to='djangoldp_tzcld.TzcldTerritorySynthesisFollowed'), + ), + migrations.AlterField( + model_name='tzcldterritorysharednote', + name='communityAdmins', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_admins_community_shared_notes', to='djangoldp_tzcld.TzcldCommunityIdentity'), + ), + migrations.AlterField( + model_name='tzcldterritorysharednote', + name='communityReferents', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_referents_community_shared_notes', to='djangoldp_tzcld.TzcldTerritorySynthesisFollowed'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0056_alter_tzcldterritorysynthesisfollowed_community.py b/djangoldp_tzcld/migrations/0056_alter_tzcldterritorysynthesisfollowed_community.py new file mode 100644 index 0000000000000000000000000000000000000000..ee76ae52926193b1f0463043828492ef39fa8a32 --- /dev/null +++ b/djangoldp_tzcld/migrations/0056_alter_tzcldterritorysynthesisfollowed_community.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.6 on 2023-10-09 07:57 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_community', '0012_alter_communitymember_options'), + ('djangoldp_tzcld', '0055_auto_20231006_1539'), + ] + + operations = [ + migrations.AlterField( + model_name='tzcldterritorysynthesisfollowed', + name='community', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='tzcld_community_synthesis_followed', to='djangoldp_community.community'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0057_alter_tzcldcommunitydeliberation_options_and_more.py b/djangoldp_tzcld/migrations/0057_alter_tzcldcommunitydeliberation_options_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..481eb26c4b100a21475cf01bf7afbc859b2243be --- /dev/null +++ b/djangoldp_tzcld/migrations/0057_alter_tzcldcommunitydeliberation_options_and_more.py @@ -0,0 +1,106 @@ +# Generated by Django 4.2.6 on 2023-10-20 13:24 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('djangoldp_tzcld', '0056_alter_tzcldterritorysynthesisfollowed_community'), + ] + + operations = [ + migrations.AlterModelOptions( + name='tzcldcommunitydeliberation', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Territory deliberation', 'verbose_name_plural': 'TZCLD Options Territories deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldcouncildepartmentdeliberation', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Council department deliberation', 'verbose_name_plural': 'TZCLD Options Council department deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldothercommunitydeliberation', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Other Territory deliberation', 'verbose_name_plural': 'TZCLD Options Other Community deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldprofilesmembership', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Membership type', 'verbose_name_plural': 'TZCLD Options Membership types'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorieskind', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Territory Kind', 'verbose_name_plural': 'TZCLD Options Territories Kind'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriesoriginmobilization', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Origin Mobilization', 'verbose_name_plural': 'TZCLD Options Origins Mobilization'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriesstepstate', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Territory step state', 'verbose_name_plural': 'TZCLD Options Territories step states'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriestrainingcourse', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Training Course', 'verbose_name_plural': 'TZCLD Options Training Courses'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriestrainingpromotion', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Training Promotion', 'verbose_name_plural': 'TZCLD Options Training Promotions'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorydepartment', + options={'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'verbose_name': 'TZCLD Department', 'verbose_name_plural': 'TZCLD Options Departments'}, + ), + migrations.AddField( + model_name='tzcldcommunityevaluationpointanswer', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tzcldcommunityevaluationpointanswer', + name='date', + field=models.DateField(auto_now=True, verbose_name='Date'), + ), + migrations.AddField( + model_name='tzcldcommunityfollowedpointanswer', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tzcldcommunityfollowedpointanswer', + name='date', + field=models.DateField(auto_now=True, verbose_name='Date'), + ), + migrations.AddField( + model_name='tzcldcommunityidentity', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tzcldcommunityidentity', + name='date', + field=models.DateField(auto_now=True, verbose_name='Date'), + ), + migrations.AddField( + model_name='tzcldterritoryrequest', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='territory_request_author', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tzcldterritorysynthesisfollowed', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='tzcldterritorysynthesisfollowed', + name='date', + field=models.DateField(auto_now=True, verbose_name='Date'), + ), + migrations.AlterField( + model_name='tzcldterritorysharedfile', + name='date', + field=models.DateField(auto_now=True, verbose_name='Date'), + ), + ] diff --git a/djangoldp_tzcld/migrations/0058_rename_communityadmins_tzcldterritorysharedfile_community_admins_and_more.py b/djangoldp_tzcld/migrations/0058_rename_communityadmins_tzcldterritorysharedfile_community_admins_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..c3ff2e6dae8f4d5cd4ed73b151ec41f09892036a --- /dev/null +++ b/djangoldp_tzcld/migrations/0058_rename_communityadmins_tzcldterritorysharedfile_community_admins_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.6 on 2023-10-24 14:48 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0057_alter_tzcldcommunitydeliberation_options_and_more'), + ] + + operations = [ + migrations.RenameField( + model_name='tzcldterritorysharedfile', + old_name='communityAdmins', + new_name='community_admins', + ), + migrations.RenameField( + model_name='tzcldterritorysharedfile', + old_name='communityReferents', + new_name='community_referents', + ), + migrations.RenameField( + model_name='tzcldterritorysharednote', + old_name='communityAdmins', + new_name='community_admins', + ), + migrations.RenameField( + model_name='tzcldterritorysharednote', + old_name='communityReferents', + new_name='community_referents', + ), + ] diff --git a/djangoldp_tzcld/models.py b/djangoldp_tzcld/models.py index 54e3e80aa908a21be0a9d0068ce36728dc0650dc..585f9cefe327075038652a17ea5b505c3ec4c9c5 100644 --- a/djangoldp_tzcld/models.py +++ b/djangoldp_tzcld/models.py @@ -26,7 +26,7 @@ class TzcldTerritoryDepartment(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Department') - verbose_name_plural = _("TZCLD Departments") + verbose_name_plural = _("TZCLD Options Departments") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit', 'add', 'change', 'delete'] @@ -69,7 +69,7 @@ class TzcldProfilesMembership(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Membership type') - verbose_name_plural = _("TZCLD Membership types") + verbose_name_plural = _("TZCLD Options Membership types") anonymous_perms = [] authenticated_perms = ['view', 'add'] owner_perms = ['inherit', 'change', 'delete'] @@ -230,7 +230,7 @@ class TzcldTerritoriesStepState(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory step state') - verbose_name_plural = _("TZCLD Territories step states") + verbose_name_plural = _("TZCLD Options Territories step states") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit'] @@ -251,7 +251,7 @@ class TzcldTerritoriesKind(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Kind') - verbose_name_plural = _("TZCLD Territories Kind") + verbose_name_plural = _("TZCLD Options Territories Kind") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit'] @@ -272,7 +272,7 @@ class TzcldTerritoriesOriginMobilization(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Origin Mobilization') - verbose_name_plural = _("TZCLD Origins Mobilization") + verbose_name_plural = _("TZCLD Options Origins Mobilization") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit'] @@ -294,7 +294,7 @@ class TzcldTerritoriesTrainingCourse(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Course') - verbose_name_plural = _("TZCLD Training Courses") + verbose_name_plural = _("TZCLD Options Training Courses") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit'] @@ -315,7 +315,7 @@ class TzcldTerritoriesTrainingPromotion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Promotion') - verbose_name_plural = _("TZCLD Training Promotions") + verbose_name_plural = _("TZCLD Options Training Promotions") anonymous_perms = [] authenticated_perms = ['view'] owner_perms = ['inherit'] @@ -366,6 +366,9 @@ class TzcldCommunityIdentity(Model): signatory_structure = models.CharField(max_length=254, blank=True, null=True, default='') birth_date = models.DateField(verbose_name="Project birth date", blank=True, null=True) last_contribution_date = models.DateField(verbose_name="Last contribution date", blank=True, null=True) + conversations = models.ManyToManyField(Conversation, blank=True, related_name='tzcld_community_identity') + date = models.DateField(verbose_name="Date", auto_now=True) + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) def __str__(self): try: @@ -374,6 +377,7 @@ class TzcldCommunityIdentity(Model): return self.urlid class Meta(Model.Meta): + auto_author = 'author' verbose_name = _('TZCLD Territory Identity') verbose_name_plural = _("TZCLD Territories Identities") permission_classes = [TzcldCommunityProfilePermissions] @@ -383,7 +387,8 @@ class TzcldCommunityIdentity(Model): superuser_perms = ['inherit'] ordering = ['community'] container_path = "tzcld-communities-identity/" - serializer_fields = ['@id', 'community', 'deputy', 'circonscription', 'origin_mobilization', 'application_date', 'signatory_structure', 'birth_date', 'last_contribution_date', 'territories_project_team_memebers', 'territories_trainings'] + serializer_fields = ['@id', 'community', 'deputy', 'circonscription', 'origin_mobilization', 'application_date', 'signatory_structure', 'birth_date', 'last_contribution_date', 'territories_project_team_memebers', 'territories_trainings', 'conversations', 'tzcld_admins_community_shared_notes', 'tzcld_admins_community_shared_files', 'date', 'author'] + nested_fields = ['community', 'conversations'] rdf_type = "tzcld:communityIdentity" depth = 0 @@ -479,7 +484,7 @@ class TzcldCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory deliberation') - verbose_name_plural = _("TZCLD Territories deliberations") + verbose_name_plural = _("TZCLD Options Territories deliberations") anonymous_perms = [] authenticated_perms = ['view', 'add'] owner_perms = ['inherit', 'change', 'delete'] @@ -500,7 +505,7 @@ class TzcldOtherCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Other Territory deliberation') - verbose_name_plural = _("TZCLD Other Community deliberations") + verbose_name_plural = _("TZCLD Options Other Community deliberations") anonymous_perms = [] authenticated_perms = ['view', 'add'] owner_perms = ['inherit', 'change', 'delete'] @@ -522,7 +527,7 @@ class TzcldCouncilDepartmentDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Council department deliberation') - verbose_name_plural = _("TZCLD Council department deliberations") + verbose_name_plural = _("TZCLD Options Council department deliberations") anonymous_perms = [] authenticated_perms = ['view', 'add'] owner_perms = ['inherit', 'change', 'delete'] @@ -573,7 +578,7 @@ class TzcldCommunityEvaluationPoint(Model): name = models.CharField(max_length=1024, blank=True, null=True, default='') order = models.IntegerField(blank=True, null=True, default=1) - part = models.ForeignKey(TzcldCommunityEvaluationPointPart, on_delete=models.DO_NOTHING,related_name='part_points', blank=True, null=True) + part = models.ForeignKey(TzcldCommunityEvaluationPointPart, on_delete=models.CASCADE,related_name='part_points', blank=True, null=True) points = models.IntegerField(blank=True, null=True, default=0) fieldType = models.CharField( max_length=125, @@ -608,8 +613,10 @@ class TzcldCommunityEvaluationPointAnswer(Model): answer_other_community_deliberation = models.ForeignKey(TzcldOtherCommunityDeliberation, on_delete=models.DO_NOTHING,related_name='community_answer', blank=True, null=True) answer_concil_department_deliberation = models.ForeignKey(TzcldCouncilDepartmentDeliberation, on_delete=models.DO_NOTHING,related_name='community_answer', blank=True, null=True) comment = models.TextField(blank=True, null=True) - evaluation_point = models.ForeignKey(TzcldCommunityEvaluationPoint, on_delete=models.DO_NOTHING,related_name='evaluation_point_answer', blank=False, null=True) + evaluation_point = models.ForeignKey(TzcldCommunityEvaluationPoint, on_delete=models.CASCADE,related_name='evaluation_point_answer', blank=False, null=True) community = models.ForeignKey(Community, on_delete=models.DO_NOTHING,related_name='community_answer', blank=False, null=True) + date = models.DateField(verbose_name="Date", auto_now=True) + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) def __str__(self): try: @@ -618,6 +625,7 @@ class TzcldCommunityEvaluationPointAnswer(Model): return self.urlid class Meta(Model.Meta): + auto_author = 'author' verbose_name = _('TZCLD Territory Evaluation Point Answer') verbose_name_plural = _("TZCLD Territories Evaluation Point answers") permission_classes = [TzcldCommunityProfilePermissions] @@ -626,7 +634,7 @@ class TzcldCommunityEvaluationPointAnswer(Model): owner_perms = ['inherit', 'change', 'delete'] superuser_perms = ['inherit'] container_path = "tzcld-communities-evaluation-point-answers/" - serializer_fields = ['@id', 'answer', 'answer_community_deliberation', 'answer_other_community_deliberation', 'answer_concil_department_deliberation', 'comment', 'evaluation_point', 'community'] + serializer_fields = ['@id', 'answer', 'answer_community_deliberation', 'answer_other_community_deliberation', 'answer_concil_department_deliberation', 'comment', 'evaluation_point', 'community', 'date', 'author'] rdf_type = "tzcld:communityEvaluationPointAnswer" depth = 0 @@ -686,44 +694,6 @@ class TzcldContactEmail(Model): nested_fields = [] rdf_type = "tzcld:email" -class TzcldSharedNote(Model): - - VISIBILITY_ADMINS = 'admins' - VISIBILITY_REFERENTS = 'referents' - VISIBILITY_CHOICES = [ - (VISIBILITY_ADMINS, 'Territory administrators'), - (VISIBILITY_REFERENTS, 'Referents'), - ] - - user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) - longdesc = models.TextField(blank=True, null=True) - community = models.ForeignKey(Community, on_delete=models.CASCADE, related_name='tzcld_community_shared_notes', null=True, blank=True) - conversations = models.ManyToManyField(Conversation, blank=True, related_name='tzcld_shared_notes') - visible = models.CharField( - max_length=25, - choices=VISIBILITY_CHOICES, - default=VISIBILITY_REFERENTS, - ) - date = models.DateField(verbose_name="Date", auto_now=True) - - def __str__(self): - try: - return '{} ({})'.format(self.id, self.urlid) - except: - return self.urlid - - class Meta(Model.Meta): - auto_author = 'user' - verbose_name = _('TZCLD Shared Note') - verbose_name_plural = _("TZCLD Shared Notes") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] - container_path = "tzcld-shared-note/" - serializer_fields = ['@id', 'user', 'longdesc', 'community', 'visible', 'conversations', 'date'] - nested_fields = ['community', 'conversations'] - rdf_type = "tzcld:sharedNote" class TzcldTerritoryRequest(Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL,verbose_name="Interlocuteur") @@ -731,6 +701,7 @@ class TzcldTerritoryRequest(Model): contactType = models.CharField(max_length=1024, blank=True, null=True, default='',verbose_name="Type of contact") subject = models.TextField(blank=True, null=True, verbose_name="Sujet/Demande") community = models.ForeignKey(Community, on_delete=models.DO_NOTHING,related_name='tzcld_community_requests', blank=False, null=True) + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL,related_name='territory_request_author') def __str__(self): try: @@ -739,6 +710,7 @@ class TzcldTerritoryRequest(Model): return self.urlid class Meta(Model.Meta): + auto_author = 'author' verbose_name = _('TZCLD Territory Request') verbose_name_plural = _("TZCLD Territories Requests") anonymous_perms = [] @@ -746,7 +718,7 @@ class TzcldTerritoryRequest(Model): owner_perms = ['inherit', 'change', 'delete'] superuser_perms = ['inherit'] container_path = "tzcld-territory-request/" - serializer_fields = ['@id', 'user', 'date', 'contactType', 'subject', 'community'] + serializer_fields = ['@id', 'user', 'date', 'contactType', 'subject', 'community', 'author'] nested_fields = ['user', 'community'] rdf_type = "tzcld:territoryRequest" @@ -758,7 +730,9 @@ class TzcldTerritorySynthesisFollowed(Model): questions = models.TextField(blank=True, null=True, verbose_name="Questions") needs = models.TextField(blank=True, null=True, verbose_name="Needs, Actions") targetdate = models.DateField(verbose_name="Target date", blank=True, null=True) - community = models.ForeignKey(Community, on_delete=models.DO_NOTHING,related_name='tzcld_community_synthesis_followed', blank=False, null=True) + community = models.OneToOneField(Community, on_delete=models.DO_NOTHING,related_name='tzcld_community_synthesis_followed', blank=False, null=True) + date = models.DateField(verbose_name="Date", auto_now=True) + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) def __str__(self): try: @@ -767,6 +741,7 @@ class TzcldTerritorySynthesisFollowed(Model): return self.urlid class Meta(Model.Meta): + auto_author = 'author' verbose_name = _('TZCLD Territory Synthesis Followed') verbose_name_plural = _("TZCLD Territories Synthesis Followed") anonymous_perms = [] @@ -774,7 +749,7 @@ class TzcldTerritorySynthesisFollowed(Model): owner_perms = ['inherit', 'change', 'delete'] superuser_perms = ['inherit'] container_path = "tzcld-territory-synthesis followed/" - serializer_fields = ['@id', 'context', 'strongPoints', 'questions', 'needs', 'targetdate', 'community'] + serializer_fields = ['@id', 'context', 'strongPoints', 'questions', 'needs', 'targetdate', 'community', 'tzcld_referents_community_shared_notes', 'date', 'author'] nested_fields = ['community'] rdf_type = "tzcld:territorySynthesisFollowed" @@ -815,7 +790,7 @@ class TzcldCommunityFollowedPoint(Model): name = models.CharField(max_length=1024, blank=True, null=True, default='') order = models.IntegerField(blank=True, null=True, default=1) - part = models.ForeignKey(TzcldCommunityFollowedPointPart, on_delete=models.DO_NOTHING,related_name='followed_part_points', blank=True, null=True) + part = models.ForeignKey(TzcldCommunityFollowedPointPart, on_delete=models.CASCADE,related_name='followed_part_points', blank=True, null=True) fieldType = models.CharField( max_length=25, choices=TYPE_OF_FIELD_CHOICES, @@ -846,8 +821,10 @@ class TzcldCommunityFollowedPoint(Model): class TzcldCommunityFollowedPointAnswer(Model): answer = models.TextField(blank=False, null=True) - followed_point = models.ForeignKey(TzcldCommunityFollowedPoint, on_delete=models.DO_NOTHING,related_name='followed_point_answer', blank=False, null=True) + followed_point = models.ForeignKey(TzcldCommunityFollowedPoint, on_delete=models.CASCADE,related_name='followed_point_answer', blank=False, null=True) community = models.ForeignKey(Community, on_delete=models.DO_NOTHING,related_name='tzcld_community_followed_answer', blank=False, null=True) + date = models.DateField(verbose_name="Date", auto_now=True) + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) def __str__(self): try: @@ -856,6 +833,7 @@ class TzcldCommunityFollowedPointAnswer(Model): return self.urlid class Meta(Model.Meta): + auto_author = 'author' verbose_name = _('TZCLD Territory Followed Point Answer') verbose_name_plural = _("TZCLD Territories Followed Point answers") permission_classes = [TzcldCommunityProfilePermissions] @@ -864,31 +842,48 @@ class TzcldCommunityFollowedPointAnswer(Model): owner_perms = ['inherit', 'change', 'delete'] superuser_perms = ['inherit'] container_path = "tzcld-communities-followed-point-answers/" - serializer_fields = ['@id', 'answer', 'followed_point','community'] + serializer_fields = ['@id', 'answer', 'followed_point','community', 'date', 'author'] rdf_type = "tzcld:communityFollowedPointAnswer" depth = 0 +class TzcldTerritorySharedNote(Model): + + author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL) + longdesc = models.TextField(blank=True, null=True) + community_admins = models.ForeignKey(TzcldCommunityIdentity, on_delete=models.DO_NOTHING,related_name='tzcld_admins_community_shared_notes', blank=True, null=True) + community_referents = models.ForeignKey(TzcldTerritorySynthesisFollowed, on_delete=models.DO_NOTHING,related_name='tzcld_referents_community_shared_notes', blank=True, null=True) + conversations = models.ManyToManyField(Conversation, blank=True, related_name='tzcld_shared_notes') + date = models.DateField(verbose_name="Date", auto_now=True) + + def __str__(self): + try: + return '{} ({})'.format(self.id, self.urlid) + except: + return self.urlid + + class Meta(Model.Meta): + auto_author = 'author' + verbose_name = _('TZCLD Territory Shared Note') + verbose_name_plural = _("TZCLD Territories Shared Notes") + anonymous_perms = [] + authenticated_perms = ['view', 'add'] + owner_perms = ['inherit', 'change', 'delete'] + superuser_perms = ['inherit'] + container_path = "tzcld-territory-shared-notes/" + serializer_fields = ['@id', 'author', 'longdesc', 'community_admins', 'community_referents', 'conversations', 'date'] + nested_fields = ['author', 'community_admins', 'community_referents', 'conversations'] + rdf_type = "tzcld:territorySharedNote" + class TzcldTerritorySharedFile(Model): - - VISIBILITY_ADMINS = 'admins' - VISIBILITY_REFERENTS = 'referents' - VISIBILITY_CHOICES = [ - (VISIBILITY_ADMINS, 'Territory administrators'), - (VISIBILITY_REFERENTS, 'Referents'), - ] author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL,verbose_name="Interlocuteur") name = models.CharField(max_length=1024, blank=True, null=True, default='') - date = models.DateField(verbose_name="Date") + date = models.DateField(verbose_name="Date", auto_now=True) document = models.URLField(blank=True, null=True, verbose_name="Document") - community = models.ForeignKey(Community, on_delete=models.DO_NOTHING,related_name='tzcld_community_shared_files', blank=False, null=True) - visible = models.CharField( - max_length=25, - choices=VISIBILITY_CHOICES, - default=VISIBILITY_REFERENTS, - ) + community_admins = models.ForeignKey(TzcldCommunityIdentity, on_delete=models.DO_NOTHING,related_name='tzcld_admins_community_shared_files', blank=True, null=True) + community_referents = models.ForeignKey(TzcldTerritorySynthesisFollowed, on_delete=models.DO_NOTHING,related_name='tzcld_referents_community_shared_files', blank=True, null=True) def __str__(self): try: @@ -905,8 +900,8 @@ class TzcldTerritorySharedFile(Model): owner_perms = ['inherit', 'change', 'delete'] superuser_perms = ['inherit'] container_path = "tzcld-territory-shared-files/" - serializer_fields = ['@id', 'author', 'name', 'date', 'document', 'community', 'visible'] - nested_fields = ['author', 'community'] + serializer_fields = ['@id', 'author', 'name', 'date', 'document', 'community_admins', 'community_referents'] + nested_fields = ['author', 'community_admins', 'community_referents'] rdf_type = "tzcld:territorySharedFile" diff --git a/djangoldp_tzcld/settings.py b/djangoldp_tzcld/settings.py index f6f34b2b95826a5feb69798938baefb50ade5b0b..8415118c1a05849dfadf8b90313fb7114a581627 100644 --- a/djangoldp_tzcld/settings.py +++ b/djangoldp_tzcld/settings.py @@ -1,3 +1,3 @@ -COMMUNITY_NESTED_FIELDS = ['tzcld_profile', 'tzcld_profile_identity', 'tzcld_community_synthesis_followed', 'tzcld_community_shared_notes'] +COMMUNITY_NESTED_FIELDS = ['tzcld_profile', 'tzcld_profile_identity', 'tzcld_community_synthesis_followed', 'tzcld_community_requests'] COMMUNITY_ADMIN_INLINES = [("djangoldp_tzcld.admin", "TzcldCommunityInline",)] USER_NESTED_FIELDS = ['tzcld_profile'] \ No newline at end of file