12
Окт
2016

NoReverseMatch at/ Django

Помогите пожалуйста, пол дня убил, не могу понять, почему выдает ошибку:

NoReverseMatch at /
Reverse for 'the_redhuman_is.views.new_worker' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []``

Текст ошибки:

Error during template rendering
In template /home/redhuman/redhuman_is/the_redhuman_is/templates/the_redhuman_is/base.html, error at line 7
Reverse for 'the_redhuman_is.views.new_worker' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Шаблон:

<p><a href="{% url 'the_redhuman_is.views.new_worker' %}">Собаки</a></p>

urls.py:

from django.conf.urls import url
from . import views

app_name = 'the_redhuman_is'
urlpatterns = [
url(r'^', views.base, name='base'),
url(r'^new-worker/$', views.new_worker, name='new-worker'),
]

views.py:

from .models import Worker
from .forms import WorkerForm

def base(request):
   return render(request, 'the_redhuman_is/base.html', {})

def new_worker(request):
   form = WorkerForm()
   return render(request, 'the_redhuman_is/new_worker.html', {'form': form})

forms.py:

from django import forms
from .models import Worker

class WorkerForm(forms.ModelForm):

    class Meta:
        model = Worker
        fields = ('input_date', 'last_name', 'name', 'patronymic', 'passport_number', 'birth_date', 'mig_series', 'mig_number', 'm_date_of_issue', 'm_date_of_exp',)

Источник: https://ru.stackoverflow.com/questions/577239/noreversematch-at-django

Share

Тебе может это понравится...