forTestingVersioning.py 1019 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
2
3
from .myModelVersionned import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from django.db import models
import reversion
Florent Chehab's avatar
Florent Chehab committed
4
from backend_app.utils import get_model_config, get_viewset_permissions
Florent Chehab's avatar
Florent Chehab committed
5
6
7


@reversion.register()
8
class ForTestingVersioning(MyModelVersionned):
Florent Chehab's avatar
Florent Chehab committed
9
10
11
    """
        Simple model for testing purposes
    """
Florent Chehab's avatar
Florent Chehab committed
12
    model_config = get_model_config("ForTestingVersioning")
Florent Chehab's avatar
Florent Chehab committed
13
14
    bbb = models.CharField(max_length=100)

15
16
    @classmethod
    def get_serializer(cls):
17
        return ForTestingVersioningSerializer
18

Florent Chehab's avatar
Florent Chehab committed
19

20
class ForTestingVersioningSerializer(MyModelVersionnedSerializer):
Florent Chehab's avatar
Florent Chehab committed
21
22
23
24
    """
        Same as above
    """
    class Meta:
25
        model = ForTestingVersioning
Florent Chehab's avatar
Florent Chehab committed
26
27
28
        fields = '__all__'


29
class ForTestingVersioningViewSet(MyModelVersionnedViewSet):
Florent Chehab's avatar
Florent Chehab committed
30
31
32
    """
        Same as above
    """
33
    permission_classes = get_viewset_permissions("ForTestingVersioningViewSet")
34
35
    serializer_class = ForTestingVersioningSerializer
    queryset = ForTestingVersioning.objects.all()