From ff7df815f44aaca0092477e8ad8c2efaf56b07c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=93=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=D1=85?= Date: Tue, 15 Oct 2019 15:20:44 +0300 Subject: [PATCH] Fix country_id --- .../account/migrations/0012_merge_20191015_0708.py | 14 ++++++++++++++ apps/comment/models.py | 3 --- apps/utils/permissions.py | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 apps/account/migrations/0012_merge_20191015_0708.py diff --git a/apps/account/migrations/0012_merge_20191015_0708.py b/apps/account/migrations/0012_merge_20191015_0708.py new file mode 100644 index 00000000..91dba02e --- /dev/null +++ b/apps/account/migrations/0012_merge_20191015_0708.py @@ -0,0 +1,14 @@ +# Generated by Django 2.2.4 on 2019-10-15 07:08 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('account', '0011_merge_20191014_0839'), + ('account', '0011_merge_20191014_1258'), + ] + + operations = [ + ] diff --git a/apps/comment/models.py b/apps/comment/models.py index 08ae2cde..55c7802e 100644 --- a/apps/comment/models.py +++ b/apps/comment/models.py @@ -45,9 +45,6 @@ class Comment(ProjectBaseMixin): objects = CommentQuerySet.as_manager() country = models.ForeignKey(Country, verbose_name=_('Country'), on_delete=models.SET_NULL, null=True) - # language = models.ForeignKey(Language, verbose_name=_('Locale'), - # on_delete=models.SET_NULL, null=True - # ) class Meta: """Meta class""" diff --git a/apps/utils/permissions.py b/apps/utils/permissions.py index f0da64e4..3b408b31 100644 --- a/apps/utils/permissions.py +++ b/apps/utils/permissions.py @@ -87,7 +87,7 @@ class IsCommentModerator(IsStandardUser): # Must have role role = Role.objects.filter(role=Role.COMMENTS_MODERATOR, - country__languages__id=obj.language_id)\ + country_id=obj.country_id)\ .first() # 'Comments moderator' is_access = UserRole.objects.filter(user=request.user, role=role).exists()