Я пытаюсь заполнить данные в форме модели и загрузить страницы с информационным полем объекта. Тем не менее, я получаю некоторые ошибки, и я не знаю исправить
views.py
def profile(request, id):
user = get_object_or_404(User, id=id)
user_info = get_object_or_404(UserInfor, user_id=user.id)
user_form = UserForm(instance=user)
profile_form = ProfileForm(instance=user_info)
return render(request, 'pages/profile.html', {'user': user_form, 'user_info': profile_form})
urls.py
path('profile/id=<int:id>/', views.profile, name='profile')
profile.html
<form class="form-horizontal" name="form" method="post" action="{% url 'profile' %}">
Ошибка, которую я получил
NoReverseMatch at /profile/id=2/
Reverse for 'profile' with no arguments not found. 1 pattern(s) tried:
['profile\\/id\\=(?P<id>[0-9]+)\\/$']
Request Method: GET
Request URL: http://127.0.0.1:8000/profile/id%3D2/
Django Version: 2.2.1
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'profile' with no arguments not found. 1 pattern(s) tried:
['profile\\/id\\=(?P<id>[0-9]+)\\/$']
Exception Location: F:\FTEL_CSOC\env\lib\site-
packages\django\urls\resolvers.py in _reverse_with_prefix, line 668
Python Executable: F:\FTEL_CSOC\env\Scripts\python.exe
Python Path:
['F:\\FTEL_CSOC\\webping',
'F:\\FTEL_CSOC\\webping',
'F:\\FTEL_CSOC\\webping',
'C:\\Program Files\\JetBrains\\PyCharm
2019.1.1\\helpers\\pycharm_display',
'F:\\FTEL_CSOC\\env\\Scripts\\python36.zip',
'C:\\Users\\vuthe\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',
'C:\\Users\\vuthe\\AppData\\Local\\Programs\\Python\\Python36\\lib',
'C:\\Users\\vuthe\\AppData\\Local\\Programs\\Python\\Python36',
'F:\\FTEL_CSOC\\env',
'F:\\FTEL_CSOC\\env\\lib\\site-packages',
'F:\\FTEL_CSOC\\env\\lib\\site-packages\\setuptools-40.8.0-py3.6.egg',
'C:\\Program Files\\JetBrains\\PyCharm '
'2019.1.1\\helpers\\pycharm_matplotlib_backend']
Server time: Mon, 24 Jun 2019 07:29:28 +0000
Есть идеи, почему я получаю эту ошибку?
Я пытался исправить предложение ссылки, но результат не найден. Страница