Skip to content
Snippets Groups Projects
Verified Commit 62d13a8b authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add metaclass for model versioning

parent a4bb3da9
Branches master
No related tags found
1 merge request!249Add metaclass for model versioning
Pipeline #1957 passed with warnings
...@@ -17,8 +17,14 @@ from material.base import Layout, LayoutNode ...@@ -17,8 +17,14 @@ from material.base import Layout, LayoutNode
from rules.contrib.admin import ObjectPermissionsModelAdmin from rules.contrib.admin import ObjectPermissionsModelAdmin
@reversion.register class ExtensibleModelVersioning(type):
class ExtensibleModel(models.Model): """ Meta class to add django-reversion decorator. """
def __new__(mcls, name, bases, attrs):
return reversion.register(super().__new__, (name, bases, attrs))
class ExtensibleModel(models.Model, metaclass=ExtensibleModelVersioning):
"""Base model for all objects in AlekSIS apps. """Base model for all objects in AlekSIS apps.
This base model ensures all objects in AlekSIS apps fulfill the This base model ensures all objects in AlekSIS apps fulfill the
......
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