Commit 81f7ac47 authored by dani2612's avatar dani2612
Browse files

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
Loading
Loading
Loading
Loading
+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
+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 %}
+1 −1
Original line number Diff line number Diff line
@@ -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>       
+1 −0
Original line number Diff line number Diff line
@@ -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'),
]
+10 −0
Original line number Diff line number Diff line
@@ -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