forTestingVersioning.py 1.01 KB
Newer Older
1 2 3 4 5
from .myModelVersionned import (
    MyModelVersionned,
    MyModelVersionnedSerializer,
    MyModelVersionnedViewSet,
)
Florent Chehab's avatar
Florent Chehab committed
6 7
from django.db import models
import reversion
Florent Chehab's avatar
Florent Chehab committed
8
from backend_app.utils import get_model_config, get_viewset_permissions
Florent Chehab's avatar
Florent Chehab committed
9 10 11


@reversion.register()
12
class ForTestingVersioning(MyModelVersionned):
Florent Chehab's avatar
Florent Chehab committed
13 14 15
    """
        Simple model for testing purposes
    """
16

17
    model_config = get_model_config("ForTestingVersioning")
Florent Chehab's avatar
Florent Chehab committed
18 19
    bbb = models.CharField(max_length=100)

20 21
    @classmethod
    def get_serializer(cls):
22
        return ForTestingVersioningSerializer
23

Florent Chehab's avatar
Florent Chehab committed
24

25
class ForTestingVersioningSerializer(MyModelVersionnedSerializer):
Florent Chehab's avatar
Florent Chehab committed
26 27 28
    """
        Same as above
    """
29

Florent Chehab's avatar
Florent Chehab committed
30
    class Meta:
31
        model = ForTestingVersioning
32
        fields = "__all__"
Florent Chehab's avatar
Florent Chehab committed
33 34


35
class ForTestingVersioningViewSet(MyModelVersionnedViewSet):
Florent Chehab's avatar
Florent Chehab committed
36 37 38
    """
        Same as above
    """
39

40
    permission_classes = get_viewset_permissions("ForTestingVersioningViewSet")
41 42
    serializer_class = ForTestingVersioningSerializer
    queryset = ForTestingVersioning.objects.all()