Skip to content

Commit

Permalink
fix: Fix migration error
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Jul 22, 2023
1 parent ab7db25 commit ecd8e07
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.20 on 2023-07-21 21:50
# Generated by Django 3.2.20 on 2023-07-22 18:30

from django.db import migrations

Expand All @@ -20,7 +20,7 @@ class Migration(migrations.Migration):
'indexes': [],
'constraints': [],
},
bases=('content_tagging.contenttaxonomy', 'oel_tagging.usersystemdefinedtaxonomy'),
bases=('oel_tagging.usersystemdefinedtaxonomy',),
),
migrations.CreateModel(
name='ContentLanguageTaxonomy',
Expand All @@ -31,7 +31,7 @@ class Migration(migrations.Migration):
'indexes': [],
'constraints': [],
},
bases=('content_tagging.contenttaxonomy', 'oel_tagging.languagetaxonomy'),
bases=('oel_tagging.languagetaxonomy',),
),
migrations.CreateModel(
name='OrganizarionSystemDefinedTaxonomy',
Expand Down Expand Up @@ -64,6 +64,6 @@ class Migration(migrations.Migration):
'indexes': [],
'constraints': [],
},
bases=('content_tagging.contenttaxonomy', 'content_tagging.organizarionsystemdefinedtaxonomy'),
bases=('content_tagging.organizarionsystemdefinedtaxonomy',),
),
]
54 changes: 30 additions & 24 deletions openedx/features/content_tagging/models/system_defined.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,55 +54,61 @@ def object_tag_class(self) -> Type:
return OrganizationModelObjectTag


class ContentLanguageTaxonomy(
ContentTaxonomy,
LanguageTaxonomy
):
class ContentLanguageTaxonomy(LanguageTaxonomy):
"""
Language system-defined taxonomy that accepts ContentTags
Inherit `_check_object` and `_check_taxonomy` from ContentTaxonomy
and inherit `_check_tag` from LanguageTaxonomy
Inherit `_check_tag` from LanguageTaxonomy and uses
`_check_object` and `_check_taxonomy` from ContentTaxonomy
"""

class Meta:
proxy = True

def _check_tag(self, object_tag: ObjectTag) -> bool:
return super(LanguageTaxonomy, self)._check_tag(object_tag)
def _check_object(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_object(object_tag) # pylint: disable=protected-access

def _check_taxonomy(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_taxonomy(object_tag) # pylint: disable=protected-access

class ContentAuthorTaxonomy(
ContentTaxonomy,
UserSystemDefinedTaxonomy
):

class ContentAuthorTaxonomy(UserSystemDefinedTaxonomy):
"""
Author system-defined taxonomy that accepts Content Tags
Inherit `_check_object` and `_check_taxonomy` from ContentTaxonomy
and inherit `_check_tag` from UserSystemDefinedTaxonomy
Inherit `_check_tag` from UserSystemDefinedTaxonomy and uses
`_check_object` and `_check_taxonomy` from ContentTaxonomy
"""

class Meta:
proxy = True

def _check_tag(self, object_tag: ObjectTag) -> bool:
return super(UserSystemDefinedTaxonomy, self)._check_tag(object_tag)
def _check_object(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_object(object_tag) # pylint: disable=protected-access

def _check_taxonomy(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_taxonomy(object_tag) # pylint: disable=protected-access


class ContentOrganizationTaxonomy(
ContentTaxonomy,
OrganizarionSystemDefinedTaxonomy
):
class ContentOrganizationTaxonomy(OrganizarionSystemDefinedTaxonomy):
"""
Organization system-defined taxonomy that accepts Content Tags
Inherit `_check_object` and `_check_taxonomy` from ContentTaxonomy
and inherit `_check_tag` from OrganizarionSystemDefinedTaxonomy
Inherit `_check_tag` from OrganizarionSystemDefinedTaxonomy and uses
`_check_object` and `_check_taxonomy` from ContentTaxonomy
"""

class Meta:
proxy = True

def _check_tag(self, object_tag: ObjectTag) -> bool:
return super(OrganizarionSystemDefinedTaxonomy, self)._check_tag(object_tag)
def _check_object(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_object(object_tag) # pylint: disable=protected-access

def _check_taxonomy(self, object_tag: ObjectTag) -> bool:
taxonomy = ContentTaxonomy().copy(self)
return taxonomy._check_taxonomy(object_tag) # pylint: disable=protected-access

0 comments on commit ecd8e07

Please sign in to comment.