Skip to content

Instantly share code, notes, and snippets.

@tamert
Created September 15, 2020 18:53
Show Gist options
  • Save tamert/d801dfd5d5daf4b4d038cc0ce452a177 to your computer and use it in GitHub Desktop.
Save tamert/d801dfd5d5daf4b4d038cc0ce452a177 to your computer and use it in GitHub Desktop.
views.py
from .models import Company
from .serializers import CompanySerializer
from rest_framework.generics import ListAPIView
class CompaniesView(ListAPIView):
queryset = Company.objects.all()
serializer_class = CompanySerializer
search_fields = ['name']
ordering_fields = ['id', 'name', 'created_at']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment