In your urls.py file you have to add the variable you want to add to the URL....
You currently have : url(r'^region', views.region, name='region'), But it should be: url(r'^region/(?P<cnty>[\w-]+)/$', views.region, name='region'), Otherwise the url doesn't know where to get the cnty variable from and therefore you get the error. Regards, Andréas 2017-06-12 14:12 GMT+02:00 jon stan <[email protected]>: > So i keep getting this error every time i try to pass a variable in http. > > in my template i have a link that contains the variable of a county in a > state: > > *template.html* > <li><a href="/main/region/{{cnty}}/">{{ cnty }}</a></li> > > when you click the link i guess it goes to the urls file: > > *urls.py* > url(r'^region', views.region, name='region'), > > and then it gets picked up by the views file but i keep getting an error > for some reason: > > *views.py* > def region(request, cnty): > > return render( > request, 'region.html', context={'cnty':cnty}, > ) > > the error says "region() takes 2 arguments 1 given", but i dont understand > how im only giving 1 argument? > > -- > 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/7762d655-1ae3-49fa-887a-0ade6bd3c00d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/7762d655-1ae3-49fa-887a-0ade6bd3c00d%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/CAK4qSCd5jqvv0XH%3DZP82hmeMGrghwLiF%2BwmSHakxS90RNwhiGw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

