Explore >> Select a destination


You are here

sam.hooke.me
| | www.django-rest-framework.org
12.2 parsecs away

Travel
| | Django, API, REST, Serializer relations
| | humberto.io
12.5 parsecs away

Travel
| | Discover how to separate your stacks to get autonomy between frontend and backend using Angular 6 and Django 2
| | davi.sh
8.4 parsecs away

Travel
| | I often want to include related nested objects in my Django REST Framework ModelViewSets for CRUD operations, but don't want those related objects cluttering up the list view. To accomplish this, you can return a serializer from get_serializer_class() that doesn't include the nested relation when the ViewSet action is list. I ended up doing this on a bunch of viewsets, so I factored the logic out into a separate mixin: from typing import Union from rest_framework import viewsets class ListSerializerMixi....
| | jinyuz.dev
43.8 parsecs away

Travel
| Often, I forget how to display the raw SQL of a queryset in Django. This is a quick and easy example of how to do it from django.contrib.auth.models import User qs = User.objects.all() print(qs.query) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user"