Refactored container views to new style.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div>New Assets:</div>
|
||||
{% if asset_list %}
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
@@ -16,7 +15,7 @@
|
||||
<tbody>
|
||||
{% for asset in asset_list %}
|
||||
<tr>
|
||||
<td><a href="{% url 'asset:asset-update' asset.id %}"><div>{{ asset.named_id }}: {{ asset.description }}</div></a></td>
|
||||
<td><a href="{% url 'asset:update' asset.id %}"><div>{{ asset.named_id }}: {{ asset.description }}</div></a></td>
|
||||
<td>{{ asset.quantity }}</td>
|
||||
<td><a class="btn btn-outline-primary btn-sm" href="{% url 'asset:delete' asset.id %}" role="button">Delete</a></td>
|
||||
</tr>
|
||||
|
@@ -6,9 +6,8 @@ app_name = 'asset'
|
||||
urlpatterns = [
|
||||
path('', AssetListView.as_view(), name='list'),
|
||||
path('add/', AssetCreateView.as_view(), name='add'),
|
||||
path('<int:pk>/', AssetUpdateView.as_view(), name='asset-update'),
|
||||
path('<int:pk>/', AssetUpdateView.as_view(), name='update'),
|
||||
path('<int:pk>/', AssetUpdateView.as_view(), name='detail'),
|
||||
path('<int:asset_id>/save', views.asset_save, name='asset-save'),
|
||||
path('<int:pk>/delete/', AssetDeleteView.as_view(), name='delete'),
|
||||
]
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class AssetUpdateView(UpdateView):
|
||||
|
||||
class AssetDeleteView(DeleteView):
|
||||
model = Asset
|
||||
success_url = reverse_lazy('asset-index')
|
||||
success_url = reverse_lazy('asset:list')
|
||||
|
||||
|
||||
class AssetListView(generic.ListView):
|
||||
@@ -48,4 +48,4 @@ def asset_save(request, asset_id):
|
||||
asset.description = request.POST['description']
|
||||
asset.quantity = request.POST['quantity']
|
||||
asset.save();
|
||||
return HttpResponseRedirect(reverse('asset:index'))
|
||||
return HttpResponseRedirect(reverse('asset:list'))
|
||||
|
Reference in New Issue
Block a user