Django:我的Register_Lost页面没有显示出来

时间:2017-06-05 07:08:42

标签: python django

django还是新手,请帮帮我

Urls.py:

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'),`

Views.py:

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'

lost_items.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

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 %}

1 个答案:

答案 0 :(得分:0)

尝试切换urlpatterns列表

中的行

这个:

url(r'/addlostitems/$', views.RegisterLostView.as_view(), name='register_lost'),

之前:

url(r'lostitems/', views.LostItemsView.as_view(), name='lost_items'),