diff --git a/asset/templates/asset/asset_form.html b/asset/templates/asset/asset_form.html
index 2dff386..dccae0a 100644
--- a/asset/templates/asset/asset_form.html
+++ b/asset/templates/asset/asset_form.html
@@ -1,6 +1,23 @@
-{% extends 'base.html' %}
+{% extends "base.html" %}
{% load static %}
+{% block title %}Edit Asset: {{ asset.named_id }}{% endblock %}
+
{% block content %}
-
Form for Asset
-{% endblock %}
+
+{% endblock content %}
diff --git a/asset/urls.py b/asset/urls.py
index 38c039e..124fd33 100644
--- a/asset/urls.py
+++ b/asset/urls.py
@@ -1,4 +1,5 @@
from django.urls import path
+from . import views
from asset.views import AssetCreateView, AssetDeleteView, AssetUpdateView, AssetIndexView
app_name = 'asset'
@@ -6,6 +7,7 @@ urlpatterns = [
path('', AssetIndexView.as_view(), name='index'),
path('add/', AssetCreateView.as_view(), name='asset-add'),
path('/', AssetUpdateView.as_view(), name='asset-update'),
+ path('/save', views.asset_save, name='asset-save'),
path('/delete/', AssetDeleteView.as_view(), name='asset-delete'),
]
diff --git a/asset/views.py b/asset/views.py
index baca53e..d0d99d9 100644
--- a/asset/views.py
+++ b/asset/views.py
@@ -2,6 +2,8 @@ from django.urls import reverse_lazy
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views import generic
from asset.models import Asset
+from django.shortcuts import get_object_or_404, reverse
+from django.http import HttpResponse, HttpResponseRedirect
class AssetCreateView(CreateView):
model = Asset
@@ -23,3 +25,10 @@ class AssetIndexView(generic.ListView):
# Return the last 20 created containers
return Asset.objects.order_by('-created_ts')[:20]
+def asset_save(request, asset_id):
+ asset = get_object_or_404(Asset, pk=asset_id)
+ asset.description = request.POST['description']
+ asset.quantity = request.POST['quantity']
+ asset.save();
+ return HttpResponseRedirect(reverse('asset:index'))
+