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
No related branches found
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
from rules.contrib.admin import ObjectPermissionsModelAdmin
@reversion.register
class ExtensibleModel(models.Model):
class ExtensibleModelVersioning(type):
""" 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.
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