you have to do a Queryset
<https://docs.djangoproject.com/fr/3.0/ref/models/querysets/> inside your
view function , something like :
@login_required
def Home(request):
return render(request,'home.html',{})
@login_required
def JsonFunction(request):
dataset = YourModel.objects.all()
data = list(dataset)
return JsonResponse(data, safe=False)
that's only an example you need to set what you want to show
Le samedi 30 mai 2020 14:12:07 UTC+1, bharat pamnani a écrit :
>
> I am a beginner in django and i need to build an app which enter some user
> data and their activity period by creating model i can do that to store in
> sql database.
> The problem is i need to display that data in json format any help will be
> really appreciated
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/bce2ba78-b1a0-4ae6-8cd0-11290c7fadd7%40googlegroups.com.