Loading things/templates/things/category_form.html 0 → 100644 +33 −0 Original line number Diff line number Diff line {% extends 'main.html' %} {% load bootstrap3 %} {% load static %} {% block content %} <form action="" method="post"> {% csrf_token %} {% bootstrap_form %} {% buttons %} <button type="submit" class="btn btn-primary"> {% bootstrap_icon "star" %} Submit </button> {% endbuttons %} </form> {% endblock %} No newline at end of file things/templates/things/category_list.html +39 −0 Original line number Diff line number Diff line {% extends 'main.html' %} {% load bootstrap3 %} {% block content %} <table class="table table-dark"> <thead> <tr> <th scope="col"></th> <th scope="col">Id</th> <th scope="col">Name</th> <th scope="col">Description</th> <th scope="col">Parent</th> </tr> </thead> <tbody> {% for obj in Category %} <tr scope="row"> <td><a href='{% url 'things:editcategory' obj.id %}'> <a href='{% url 'things:deletecategory' obj.id %}'> </td> <td >{{ obj.id }}</td> <td >{{ obj.name }}</td> <td >{{ obj.description }}</td> <td >{{ obj.parent }}</td> </tr> {% endfor %} </tbody> {% endblock %} things/templates/things/thing_list.html +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ {% block content %} <a href='{% url 'things:create' %}' class="btn btn-info" role="button" >Add Thing</a> <table class="table table-dark"> <thead> <tr> Loading things/urls.py +1 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,5 @@ urlpatterns = [ url(r'^new', views.ThingCreateView.as_view(),name='create'), url(r'^(?P<pk>[0-9]+)', views.ThingUpdateView.as_view(),name='update'), url(r'^(?P<pk>[0-9]+)/delete/', views.ThingDeleteView.as_view(),name='delete'), url(r'^categories/', views.CategoryListView.as_view(),name='categoryindex'), ] things/views.py +10 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,16 @@ from django.urls.base import reverse_lazy class CategoryCreateView(generic.CreateView): model = Category fields = [ 'name', 'description', 'parent' ] class CategoryListView(generic.ListView): model = Category Loading Loading
things/templates/things/category_form.html 0 → 100644 +33 −0 Original line number Diff line number Diff line {% extends 'main.html' %} {% load bootstrap3 %} {% load static %} {% block content %} <form action="" method="post"> {% csrf_token %} {% bootstrap_form %} {% buttons %} <button type="submit" class="btn btn-primary"> {% bootstrap_icon "star" %} Submit </button> {% endbuttons %} </form> {% endblock %} No newline at end of file
things/templates/things/category_list.html +39 −0 Original line number Diff line number Diff line {% extends 'main.html' %} {% load bootstrap3 %} {% block content %} <table class="table table-dark"> <thead> <tr> <th scope="col"></th> <th scope="col">Id</th> <th scope="col">Name</th> <th scope="col">Description</th> <th scope="col">Parent</th> </tr> </thead> <tbody> {% for obj in Category %} <tr scope="row"> <td><a href='{% url 'things:editcategory' obj.id %}'> <a href='{% url 'things:deletecategory' obj.id %}'> </td> <td >{{ obj.id }}</td> <td >{{ obj.name }}</td> <td >{{ obj.description }}</td> <td >{{ obj.parent }}</td> </tr> {% endfor %} </tbody> {% endblock %}
things/templates/things/thing_list.html +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ {% block content %} <a href='{% url 'things:create' %}' class="btn btn-info" role="button" >Add Thing</a> <table class="table table-dark"> <thead> <tr> Loading
things/urls.py +1 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,5 @@ urlpatterns = [ url(r'^new', views.ThingCreateView.as_view(),name='create'), url(r'^(?P<pk>[0-9]+)', views.ThingUpdateView.as_view(),name='update'), url(r'^(?P<pk>[0-9]+)/delete/', views.ThingDeleteView.as_view(),name='delete'), url(r'^categories/', views.CategoryListView.as_view(),name='categoryindex'), ]
things/views.py +10 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,16 @@ from django.urls.base import reverse_lazy class CategoryCreateView(generic.CreateView): model = Category fields = [ 'name', 'description', 'parent' ] class CategoryListView(generic.ListView): model = Category Loading