Login

Tag "rest-api"

Snippet List

DRF - Optimizing ModelViewSet queries

Using Django REST Framework for Model views there is always the issue of making duplicated queries without either prefetching the objects that will be accessed using the serializer and as such will lead to large number of queries being made to the database. This will help in optimizing the queryset used for the viewset by accessing the `_meta.fields` property of the serializer.

  • django
  • rest
  • rest-api
  • django-rest-framework
Read More

Bit.ly url shortener

A small function to convert a url to another shortened via the bit.ly service. Requires a username and password in django settings.

  • bit.ly
  • rest-api
  • url-shortening
Read More

2 snippets posted so far.