from django.shortcuts import render
from django.contrib.auth.models import User, Group
from .models import Pytanie
from rest_framework import viewsets
from rest_framework import permissions
from .serializers import UserSerializer, GroupSerializer,PytanieSerializer
# Create your views here.

class UserViewSet(viewsets.ModelViewSet):
    queryset =User.objects.all().order_by('-date_joined')
    serializer_class=UserSerializer
    permission_classes=[permissions.IsAuthenticated]
    

class GroupViewSet(viewsets.ModelViewSet):
    queryset =Group.objects.all()
    serializer_class=GroupSerializer
    permission_classes=[permissions.IsAuthenticated]
    
class PytanieViewSet(viewsets.ModelViewSet):
    queryset =Pytanie.objects.all()
    serializer_class=PytanieSerializer
    permission_classes=[permissions.IsAuthenticated]
from django.shortcuts import render
from django.contrib.auth.models import User, Group
from .models import Pytanie
from rest_framework import viewsets
from rest_framework import permissions
from .serializers import UserSerializer, GroupSerializer,PytanieSerializer
# Create your views here.

class UserViewSet(viewsets.ModelViewSet):
    queryset =User.objects.all().order_by('-date_joined')
    serializer_class=UserSerializer
    permission_classes=[permissions.IsAuthenticated]
    

class GroupViewSet(viewsets.ModelViewSet):
    queryset =Group.objects.all()
    serializer_class=GroupSerializer
    permission_classes=[permissions.IsAuthenticated]
    
class PytanieViewSet(viewsets.ModelViewSet):
    queryset =Pytanie.objects.all()
    serializer_class=PytanieSerializer
    permission_classes=[permissions.IsAuthenticated]
# Create your views here.