Hello friends ,
I am trying to send a simple parameter to view from my template .
But i am getting the error 'Reverse for acceptfriend with arguments
('[email protected]',) and keyword arguments {} not found.
Plzz help me !! I am not much comfortable with url concepts !!
----> i need to pass [email protected] to my view !!
###################################################### url.py
##############################################################
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'app.views.home',name='homeurl'),
url(r'^signup/$','app.views.signup',name='signupurl'),
url(r'^verifylogin/$','app.views.loginverify',name='verifyloginurl'),
url(r'^verifysignup/$','app.views.signupverify',name='verifysignupurl'),
url(r'^login/$','app.views.login',name='loginurl'),
# url(r'^imgurl/$','app.views.imageviewer',name='imgurl'),
url(r'^uploadpic/$','app.views.uploadpic',name='uploadpic'),
url(r'^refreshpage/$','app.views.refreshpage',name='refreshpage'),
url(r'^acceptfriend/?(\w+)/$', 'app.views.acceptfriend','acceptfriend'),
)+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
###################################################### profile.html (my
template )##################################################################
..
..
..{% for g in list_reqfromemail %}
<tr>
<td> <a href="{% url
'acceptfriend' g %}">{{ g }} </a></td>
</tr>
{% endfor %}
#################################################### views.py
################################################################################
def acceptfriend(request,reqfromemail):
try:
myemail=request.session['email']
print("\n\n",request,"\n\n",myemail,"\n\n",reqfromemail)
return
render(request,'success.html',{"message":"congrats","name":myemail})
except:
return render(request,'error.html',{"error":"It is not working
!!!"})
###########################################################################################################################################
If i remove the href line from my template ,profile.html then my app runs
normally !!
So obviously there is some mistake that i am doing while using href ,or
sending url parameters or in extracting it. Also what is the use of
reverse() in django i read the documentation but i am unable to understand
it !!
--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f300d565-d747-46a4-b685-2c1df8bb2d19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.