Here are my view and urls
app url
app_name = 'profs'
urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^contact/', views.contact, name='contact'),
    url(r'^check_login/', views.check_login, name='check_login'),
    url(r'^(?P<url_name_para>[a-zA-Z]+)/edit_news/$', views.edit_news, name=
'edit_news'),
    url(r'^(?P<url_name_para>[a-zA-Z]+)/$', views.show, name='show'),
]
root url
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include('profs.urls')),
]
view
def check_login(request):
    if request.method == 'POST':
        if request.POST.get('username') != '' and request.POST.get(
'password') != '' and request.POST.get('password') != 'free':
            prof = get_object_or_404(Professional, url_name=request.POST.get
('username'))
            if prof.subscription == request.POST.get('password'):
                return redirect('edit_news', url_name_para = request.POST.
get('username'))
                #return render(request, 'profs/edit_news.html', {'prof': 
prof})
            else:
                return render(request, 'profs/test.html', {'val': 1})
        else:
            return render(request, 'profs/test.html', {'val': 2})
    else:
        return render(request, 'profs/test.html', {'val': 3})
def edit_news(request, url_name_para):
    if request.method == 'POST':
        
Professional.objects.filter(url_name=request.POST.get('url_name')).update(update_news=request.POST.get('editor1'))
        return render(request, 'profs/index.html')

    prof = get_object_or_404(Professional, url_name=url_name_para)
    return render(request, 'profs/edit_news.html', {'prof': prof})

If I visit directly "http://127.0.0.1:8000/dtsik/edit_news/"; I get this 
error
NoReverseMatch at /dtsik/edit_news/
Reverse for 'edit_news' with arguments '()' and keyword arguments '{}' not 
found. 1 pattern(s) tried: ['(?P<url_name_para>[a-zA-Z]+)/edit_news/$']


When I submit to check login I get this error
NoReverseMatch at /check_login/
Reverse for 'edit_news' with arguments '()' and keyword arguments '{'
url_name_para': 'dtsik'}' not found. 0 pattern(s) tried: []


What is the problem? Though is something with url pattern but cant figure it out

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/061336d6-7ff2-4cc1-bad5-907fe3b5a988%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to