Commit 81f7ac47 authored by dani2612's avatar dani2612

aggiunto un link per la creazione alla view di index delle things

aggiunte due view la lista delle categories e per la creazione non
ultimate
parent a14d96fb
{% 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
{% 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 %}
......@@ -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>
......
......@@ -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'),
]
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment