You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
537 B
15 lines
537 B
from rest_framework import viewsets
|
|
from rest_framework.permissions import IsAuthenticated
|
|
from .models import InfoArticle
|
|
from .serializers import InfoArticleSerializer
|
|
|
|
class InfoArticleViewSet(viewsets.ModelViewSet):
|
|
serializer_class = InfoArticleSerializer
|
|
permission_classes = [IsAuthenticated]
|
|
|
|
def get_queryset(self):
|
|
return InfoArticle.objects.filter(dive_base=self.request.user.dive_base, is_deleted=False)
|
|
|
|
def perform_destroy(self, instance):
|
|
instance.is_deleted = True
|
|
instance.save()
|
|
|