100% working example
To view based on classes and functions:
from django.http import HttpResponseRedirect ... return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
or
from django.http import HttpResponseRedirect ... return HttpResponseRedirect(self.request.META.get('HTTP_REFERER'))
Example -
class TaskNotificationReadAllView(generic.View): def get(self, request, *args, **kwargs): TaskNotification.objects.filter(assigned_to=request.user).update(read=True) print(request.META.get('HTTP_REFERER')) return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
Huzaif Sayyed Jun 24 '19 at 9:27 2019-06-24 09:27
source share