Skip to content
Snippets Groups Projects
Verified Commit 01a6ad0c authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Make syncable_field methods to classmethods

parent 650562e0
No related branches found
No related tags found
1 merge request!248Resolve "Allow matching primary groups on arbitrary field"
Pipeline #1941 passed with warnings
......@@ -176,16 +176,18 @@ class ExtensibleModel(models.Model):
cls._safe_add(field, name)
def syncable_fields(self) -> List[models.Field]:
@classmethod
def syncable_fields(cls) -> List[models.Field]:
""" Collect all fields that can be synced on a model """
return [field for field in self._meta.fields if (
return [field for field in cls._meta.fields if (
field.editable and not field.auto_created and not field.is_relation)]
def syncable_fields_choices(self) -> Tuple[Tuple[str, str]]:
@classmethod
def syncable_fields_choices(cls) -> Tuple[Tuple[str, str]]:
""" Collect all fields that can be synced on a model """
return tuple([(field.name, field.verbose_name) for field in self.syncable_fields()])
return tuple([(field.name, field.verbose_name) for field in cls.syncable_fields()])
class Meta:
abstract = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment