'WSGIRequest' object has no attribute 'get'

17 views
Skip to first unread message

Trippy Samurai

unread,
Nov 23, 2021, 1:11:41 AM11/23/21
to Django users
Getting error while working with template view

views.py 


class DeveloperTicketView(TemplateView):

def get_template_names(self):
if self.request.get('status') == 'Opened':
template_name = 'app/open_tickets.html'
elif self.request.get('status') == 'Accepted':
template_name = 'app/dev_accepted_tickets'
elif self.request.get('status') == "Completed":
template_name = 'app/dev_completed_tickets.html'
else:
template_name = 'app/dev_closed_tickets.html'

return template_name


def get_context_data(self, **kwargs):
context = super(DeveloperTicketView,self).get_context_data(**kwargs)
context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
context['accepted_tickets'] = Ticket.objects.filter(status = 'Accepted',accepted_by = self.request.user)
context['completed_tickets'] = Ticket.objects.filter(status = 'Completed',accepted_by = self.request.user)
context['closed_tickets'] = Ticket.objects.filter(status = 'Closed',accepted_by = self.request.user)
return context

ramadhan ngallen

unread,
Nov 23, 2021, 3:06:06 AM11/23/21
to 'Maryam Yousaf' via Django users
Surely it has self.request.GET and not self.request.get
 --
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/65cd3d84-5946-43d6-8abc-c78e4246fb07n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages