Fixed urls

This commit is contained in:
Dirk Jahnke 2022-03-10 18:19:13 +01:00
parent 16a0b92731
commit 111f147cac
4 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,5 @@
from django.contrib import admin from django.contrib import admin
# Register your models here. from .models import Asset
admin.site.register(Asset)

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load statics %} {% load static %}
{% block content %} {% block content %}
<h2>Form for Asset</h2> <h2>Form for Asset</h2>

View File

@ -9,7 +9,7 @@
{% if asset_list %} {% if asset_list %}
<ul> <ul>
{% for asset in asset_list %} {% for asset in asset_list %}
<li><a href="{% url 'asset:asset-detail' asset.id %}">{{ asset.named_id }}: {{ asset.description }}</a></li> <li><a href="{% url 'asset:asset-update' asset.id %}">{{ asset.named_id }}: {{ asset.description }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}

View File

@ -5,15 +5,15 @@ from asset.models import Asset
class AssetCreateView(CreateView): class AssetCreateView(CreateView):
model = Asset model = Asset
#fields = ['name'] fields = ['named_id', 'description', 'quantity']
class AssetUpdateView(UpdateView): class AssetUpdateView(UpdateView):
model = Asset model = Asset
#fields = ['name'] fields = ['named_id', 'description', 'quantity']
class AssetDeleteView(DeleteView): class AssetDeleteView(DeleteView):
model = Asset model = Asset
success_url = reverse_lazy('asset-list') success_url = reverse_lazy('asset-index')
class AssetIndexView(generic.ListView): class AssetIndexView(generic.ListView):
template_name = 'asset/asset_index.html' template_name = 'asset/asset_index.html'