recommendationList.py 710 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from django.db import models
2
from backend_app.models.userRestrictedModule import (
3 4 5 6
    UserRestrictedModule,
    UserRestrictedModuleSerializer,
    UserRestrictedModuleViewSet,
)
Florent Chehab's avatar
Florent Chehab committed
7 8 9


class RecommendationList(UserRestrictedModule):
10

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

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


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


24
class RecommendationListViewSet(UserRestrictedModuleViewSet):
Florent Chehab's avatar
Florent Chehab committed
25 26
    queryset = RecommendationList.objects.all()  # pylint: disable=E1101
    serializer_class = RecommendationListSerializer