Hi All, 

I have very new to Django. Can anyone tell me how to the data from URL to 
view.

in this below example I am trying to get year param from the URL. 

def get_queryset(self):
    queryset = Battles.objects.all()
    year = self.request.query_params.get('year',None)
    if year is not None:
        queryset = queryset.filter(year__exact=year)
        return queryset

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/693bbae5-0ffc-4737-86be-a9cee202e68e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to