Answers for "how to fetch module items through get_object_or_404 function"

4

get_object_or_404 django

from django.shortcuts import get_object_or_404

def my_view(request):
    obj = get_object_or_404(MyModel, pk=1)
Posted by: Guest on June-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language