I am working with django in one of my web application where i am also using userena.In userena profile template(profile_detail.html) i have added a anchor tag such as..
<a href = {% url 'send_referral_code'%}>Click here</a>
now here the send_referral_code is name value which is declared in urls.py,the urls.py is..
from django.conf.urls import patterns, url, include
from django.conf import settings
from mail import views
urlpatterns = patterns('',
url(r'^$', views.send_referral_code,name='send_referral_code'),
)
and views.py is...
from accounts.models import MyProfile
from django.core.mail import send_mail
def send_referral_code(request):
referral_code = MyProfile.objects.get(user = request.user)
send_mail('referral_code','This is Your Referral Code','you@email',['[email protected]'],fail_silently = False)
in mention, both views.py and urls.py resides another app namely 'mail'
and this is my main urls.py ..
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
import photo
urlpatterns = patterns('',
# Examples:
#url(r'^$', 'auth.views.home', name='home'),
# url(r'^shutterstock/', include('shutterstock.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^accounts/', include('userena.urls')),
url(r'^user_upload/',include('myprofile.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^showphoto/',include('photo.urls')),
url(r'^mailing/',include('mail.urls')),
)
from django.conf import settings
if settings.DEBUG:
urlpatterns += patterns(
'django.views.static',
(r'media/(?P<path>.*)',
'serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^something/hard/to/guess/', include('paypal.standard.ipn.urls')), )
now i am getting an error namely Reverse for 'send_referral_code' with arguments '()' and keyword arguments '{}' not found while i am trying to execute my site and its indicating the line
<a href = {% url 'send_referral_code'%}>Click</a>
in my profile_detail.html file of my userena apps.Now how can i solve this or whats the actual problem?