recommendationList.py 779 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2

3
from backend_app.models.userRestrictedModule import (
4 5 6 7
    UserRestrictedModule,
    UserRestrictedModuleSerializer,
    UserRestrictedModuleViewSet,
)
Florent Chehab's avatar
Florent Chehab committed
8 9 10


class RecommendationList(UserRestrictedModule):
11
    moderation_level = 0
12

Florent Chehab's avatar
Florent Chehab committed
13 14 15 16
    public = models.BooleanField()
    title = models.CharField(max_length=200)

    class Meta:
17
        unique_together = ("title", "owner")
Florent Chehab's avatar
Florent Chehab committed
18 19 20 21 22


class RecommendationListSerializer(UserRestrictedModuleSerializer):
    class Meta:
        model = RecommendationList
23
        fields = "__all__"
Florent Chehab's avatar
Florent Chehab committed
24 25


26
class RecommendationListViewSet(UserRestrictedModuleViewSet):
Florent Chehab's avatar
Florent Chehab committed
27 28
    queryset = RecommendationList.objects.all()  # pylint: disable=E1101
    serializer_class = RecommendationListSerializer
29
    end_point_route = "recommendationList"