show your url configuration
On Sep 4, 2016 3:59 PM, "Afiz S" <[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/django-users/693bbae5-0ffc-4737-86be-a9cee202e68e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAMGzuy846bY8QiT9-WEBhmzx%3DL%2Bx_OPJOpVKPFvCLuoFHpJ-ig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to