From 0c6fb39b70a45a05d7c927f0a7e1282ebdda7146 Mon Sep 17 00:00:00 2001 From: sudan45 Date: Tue, 9 Jul 2024 10:04:05 +0545 Subject: [PATCH] Update entry migrations --- ...609_0904.py => 0038_auto_20240709_0417.py} | 12 ++++++--- .../migrations/0039_auto_20240609_0933.py | 23 ----------------- ...0_alter_entryattachment_entry_file_type.py | 18 ------------- .../migrations/0041_auto_20240621_1149.py | 25 ------------------- apps/gallery/utils.py | 2 +- apps/gallery/views.py | 4 +-- 6 files changed, 12 insertions(+), 72 deletions(-) rename apps/entry/migrations/{0038_auto_20240609_0904.py => 0038_auto_20240709_0417.py} (64%) delete mode 100644 apps/entry/migrations/0039_auto_20240609_0933.py delete mode 100644 apps/entry/migrations/0040_alter_entryattachment_entry_file_type.py delete mode 100644 apps/entry/migrations/0041_auto_20240621_1149.py diff --git a/apps/entry/migrations/0038_auto_20240609_0904.py b/apps/entry/migrations/0038_auto_20240709_0417.py similarity index 64% rename from apps/entry/migrations/0038_auto_20240609_0904.py rename to apps/entry/migrations/0038_auto_20240709_0417.py index 14029c166b..faa815b897 100644 --- a/apps/entry/migrations/0038_auto_20240609_0904.py +++ b/apps/entry/migrations/0038_auto_20240709_0417.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.25 on 2024-06-09 09:04 +# Generated by Django 3.2.25 on 2024-07-09 04:17 from django.db import migrations, models import django.db.models.deletion @@ -7,6 +7,7 @@ class Migration(migrations.Migration): dependencies = [ + ('lead', '0051_auto_20240625_0509'), ('entry', '0037_merge_20220401_0527'), ] @@ -20,10 +21,15 @@ class Migration(migrations.Migration): name='EntryAttachment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('entry_file_type', models.PositiveSmallIntegerField(choices=[('1', 'XLSX')], default='1')), + ('entry_file_type', models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')], default=1)), ('file', models.FileField(upload_to='entry/attachment/')), ('file_preview', models.FileField(upload_to='entry/attachment-preview')), - ('entry', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='entry.entry')), + ('lead_attachment', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='lead.leadpreviewattachment')), ], ), + migrations.AddField( + model_name='entry', + name='entry_attachment', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='entry.entryattachment'), + ), ] diff --git a/apps/entry/migrations/0039_auto_20240609_0933.py b/apps/entry/migrations/0039_auto_20240609_0933.py deleted file mode 100644 index 53a8985094..0000000000 --- a/apps/entry/migrations/0039_auto_20240609_0933.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.2.25 on 2024-06-09 09:33 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('entry', '0038_auto_20240609_0904'), - ] - - operations = [ - migrations.RemoveField( - model_name='entryattachment', - name='entry', - ), - migrations.AddField( - model_name='entry', - name='entry_attachment', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='entry.entryattachment'), - ), - ] diff --git a/apps/entry/migrations/0040_alter_entryattachment_entry_file_type.py b/apps/entry/migrations/0040_alter_entryattachment_entry_file_type.py deleted file mode 100644 index ad7aeccb31..0000000000 --- a/apps/entry/migrations/0040_alter_entryattachment_entry_file_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.25 on 2024-06-09 10:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('entry', '0039_auto_20240609_0933'), - ] - - operations = [ - migrations.AlterField( - model_name='entryattachment', - name='entry_file_type', - field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX')], default=1), - ), - ] diff --git a/apps/entry/migrations/0041_auto_20240621_1149.py b/apps/entry/migrations/0041_auto_20240621_1149.py deleted file mode 100644 index b296b52be9..0000000000 --- a/apps/entry/migrations/0041_auto_20240621_1149.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 3.2.25 on 2024-06-21 11:49 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('entry', '0040_alter_entryattachment_entry_file_type'), - ('lead', '0051_auto_20240625_0509') - ] - - operations = [ - migrations.AddField( - model_name='entryattachment', - name='lead_attachment', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='lead.leadpreviewattachment'), - ), - migrations.AlterField( - model_name='entryattachment', - name='entry_file_type', - field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')], default=1), - ), - ] diff --git a/apps/gallery/utils.py b/apps/gallery/utils.py index 006a3fcf0e..f52ec3c55e 100644 --- a/apps/gallery/utils.py +++ b/apps/gallery/utils.py @@ -23,7 +23,7 @@ def get_private_file_url(private_file_module_type: PrivateFileModuleType, id: in ) -def check_private_condifential_level_permission(user, project, level): +def check_private_confidential_level_permission(user, project, level): permission = PP.get_permissions(project, user) if PP.Permission.VIEW_ENTRY in permission: if PP.Permission.VIEW_ALL_LEAD in permission: diff --git a/apps/gallery/views.py b/apps/gallery/views.py index c74538bf82..f4c023df8f 100644 --- a/apps/gallery/views.py +++ b/apps/gallery/views.py @@ -8,7 +8,7 @@ from django.shortcuts import redirect, get_object_or_404 from gallery.enums import PrivateFileModuleType -from gallery.utils import check_private_condifential_level_permission +from gallery.utils import check_private_confidential_level_permission from rest_framework import ( views, viewsets, @@ -97,7 +97,7 @@ def get(self, request, module=None, identifier=None, filename=None): return response.Response({ 'error': 'Unauthorized for the content' }, status.HTTP_403_FORBIDDEN) - if not check_private_condifential_level_permission(user, entry.project, entry.lead.confidentiality): + if not check_private_confidential_level_permission(user, entry.project, entry.lead.confidentiality): return response.Response({ 'error': 'Access Denied' }, status.HTTP_403_FORBIDDEN)