/fetch_users.py Secret
Created
December 4, 2019 08:16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import JsonResponse | |
from django.contrib.auth.models import User | |
def fetch_users(request): | |
return JsonResponse({"users": [{ | |
"username": u.username, "first_name": u.first_name, | |
"last_name": u.last_name, "id": u.pk} for u in User.objects.all()]}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment