basicModule.py 719 Bytes
Newer Older
1
from django.db import models
2
from backend.models.tools import UsefullLinksField
3
from backend.models.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
4
from django.contrib.postgres.fields import JSONField
5
6


7
class BasicModule(MyModelVersionned):
8

9
    comment = models.TextField(blank=True)
Florent Chehab's avatar
Florent Chehab committed
10
    usefull_links = UsefullLinksField(blank=True, default=list)
11
    custom_content = JSONField(blank=True, default=dict)
12

13
14
    class Meta:
        abstract = True
Florent Chehab's avatar
Florent Chehab committed
15
16


17
class BasicModuleSerializer(MyModelVersionnedSerializer):
Florent Chehab's avatar
Florent Chehab committed
18
19
20

    class Meta:
        model = BasicModule
21
        fields = '__all__'
22
23
24
25


class BasicModuleViewSet(MyModelVersionnedViewSet):
    serializer_class = BasicModuleSerializer