urls.py
from django.conf.urls import include, url
from . import views
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.conf import settings
from .views import Search
app_name = 'base'
urlpatterns = [
url(r'^index/$', Search.as_view(), name='index'),
url(r'^newresume/$', views.newresume, name='newresume'),
url(r'^profile/(?P<pk>[0-9]+)/$', views.profile, name='profile'),
url(r'^update_info/(?P<pk>[0-9]+)/$', views.update_info, name='update_info'),
]
views.py
def profile(request, pk):
student = get_object_or_404(Students, pk=pk)
return render(request, 'base/profile.html', {'student': student})
_tweet_search.html
<div class="studentfio">
<a href="{% url 'profile' pk=student.pk %}"><h4>{{ student.job }}</h4></a>
</div>
大家好,请帮我解决这个错误。我做了一个AJAX请求,在此之后我收到错误,我该如何解决?
答案 0 :(得分:1)
<div class="studentfio">
<a href="{% url 'base:profile' student.pk %}"><h4>{{ student.job }}</h4></a>
</div>
正如您在app_name
文件中提到的urls.py
,您需要在url