To reverse lookup an url by means of name or View_name we will use reverse function in the views like below
reverse("calendarviewurl2", kwargs={"year":theyear,"month":themonth})
and reverse function signature is as follows
http://code.djangoproject.com/browser/django/trunk/django/core/urlresolvers.py
def reverse(self, lookup_view, *args, **kwargs)
My question is related to kwargs
when we want to send a dictionary as keyword arguments we should use the below syntax snippet 1
kwargs={"year":2009,"month":9}
reverse("name",**kwargs)
as opposed to below code
snippet 2
reverse("name",kwargs={"year":2009,"month":9})
So my question is
- Do the snippet1 and snippet2 are same? ( i feel they are not same)
- In case of reverse function only snippet 2 is working where as snippet 1 is not properly working.Why is it so? (Even though the proper way to send a dictionary is by using syntax mentioned in snippet1.)