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.
 
 
 
 
padelclub_backend/tournaments/views.py

26 lines
873 B

from django.shortcuts import render
from django.http import HttpResponse
from rest_framework import viewsets, permissions
from django.contrib.auth.models import User
from .serializers import UserSerializer, ClubSerializer
from .models import Club
def index(request):
return HttpResponse("Hello, world. You're at the tournaments index.")
class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = User.objects.all().order_by('-date_joined')
serializer_class = UserSerializer
permission_classes = [permissions.IsAuthenticated]
class ClubViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows clubs to be viewed or edited.
"""
queryset = Club.objects.all().order_by('id')
serializer_class = ClubSerializer
permission_classes = [permissions.IsAuthenticated]