django还是新手,请帮帮我
from django.conf.urls import url
from . import views
app_name = 'lostfound'
urlpatterns = [
# /lostfound/
url(r'^$', views.IndexView.as_view(), name='index'),
# /lostfound/lostitems
url(r'lostitems/', views.LostItemsView.as_view(), name='lost_items'),
这是我的网址的主要问题,我无法显示我的register_lost.html
# /lostfound/lostitems/addlostitems
url(r'/addlostitems/$', views.RegisterLostView.as_view(), name='register_lost'),`
from django.views import generic
from .models import Wallet
class IndexView(generic.ListView):
model = Wallet
template_name = 'lostfound/index.html'
class LostItemsView(generic.ListView):
model = Wallet
template_name = 'lostfound/lost_items.html'
class RegisterLostView(generic.ListView):
model = Wallet
template_name = 'lostfound/register_lost.html'
<div class="menu-button z-depth-3 right">
<a class="waves-effect waves-light btn" href="{% url 'lostfound:register_lost' %}">
<i class="medium material-icons right">playlist_add</i>Tambah Data
</a>
</div>
这是我想要进程的register_lost.html
{% extends 'lostfound/base.html' %}
{% extends 'lostfound/lost_items.html' %}
{% block title %}Register Lost Items{% endblock %}
{% block content %}
{% load staticfiles %}
{% block sign_in %}
{% endblock %}
<h1>Hello</h1>
{% endblock %}
答案 0 :(得分:0)
尝试切换urlpatterns
列表
这个:
url(r'/addlostitems/$', views.RegisterLostView.as_view(), name='register_lost'),
之前:
url(r'lostitems/', views.LostItemsView.as_view(), name='lost_items'),