add a make command to remove the sqlite db restart the server

This commit is contained in:
Andreas Zweili 2019-07-24 22:52:12 +02:00
parent e162ec4177
commit abba395440
4 changed files with 12 additions and 1 deletions

View File

@ -22,6 +22,11 @@ local:
./run.sh; \ ./run.sh; \
) )
.remove_db:
rm -f ./network_inventory/network_inventory/db.sqlite3
local_restart: .remove_db local
local_test: local_test:
( \ ( \
export DJANGO_SETTINGS_MODULE=network_inventory.settings.local; \ export DJANGO_SETTINGS_MODULE=network_inventory.settings.local; \

View File

@ -8,7 +8,7 @@
</tr> </tr>
{% for customer in customer_list %} {% for customer in customer_list %}
<tr> <tr>
<td><a href="{% url 'computers' customer.id %}">{{ customer.name }}</a></td> <td><a href="{% url 'lists' customer.id %}">{{ customer.name }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -10,4 +10,6 @@ urlpatterns = [
path('computer/<int:computer_id>/', views.computer_details, path('computer/<int:computer_id>/', views.computer_details,
name='computer'), name='computer'),
path('devices/', views.DeviceList.as_view(), name='devices'), path('devices/', views.DeviceList.as_view(), name='devices'),
path('customer/<int:customer_id>/lists/', views.list_of_lists,
name='lists'),
] ]

View File

@ -28,6 +28,10 @@ def computer_details(request, computer_id):
'cpu_list': cpu_list}) 'cpu_list': cpu_list})
def list_of_lists(request, customer_id):
return render(request, 'inventory/list_of_lists.html')
class CustomerList(ListView): class CustomerList(ListView):
model = Customer model = Customer
template_name = 'inventory/customer_list.html' template_name = 'inventory/customer_list.html'