diff --git a/forms.py b/forms.py
index 90a02b9a..c727a9d1 100644
--- a/forms.py
+++ b/forms.py
@@ -7,3 +7,9 @@ class AssetForm(forms.ModelForm):
class Meta:
model = models.Asset
fields = '__all__'
+
+
+class SupplierForm(forms.ModelForm):
+ class Meta:
+ model = models.Supplier
+ fields = '__all__'
diff --git a/models.py b/models.py
index c6053816..efa32341 100644
--- a/models.py
+++ b/models.py
@@ -1,6 +1,4 @@
from django.db import models
-from django.db.models.signals import post_save
-from django.dispatch import receiver
from django.urls import reverse
@@ -27,6 +25,9 @@ class AssetStatus(models.Model):
class Supplier(models.Model):
name = models.CharField(max_length=80)
+ def get_absolute_url(self):
+ return reverse('supplier_list')
+
def __str__(self):
return self.name
diff --git a/templates/supplier_detail.html b/templates/supplier_detail.html
new file mode 100644
index 00000000..135fdeba
--- /dev/null
+++ b/templates/supplier_detail.html
@@ -0,0 +1,6 @@
+{% extends 'base.html' %}
+{% block title %}Detail{% endblock %}
+
+{% block main %}
+{{ object }}
+{% endblock %}
\ No newline at end of file
diff --git a/templates/supplier_list.html b/templates/supplier_list.html
new file mode 100644
index 00000000..bcfd8e09
--- /dev/null
+++ b/templates/supplier_list.html
@@ -0,0 +1,29 @@
+{% extends 'base.html' %}
+{% block title %}List{% endblock %}
+
+{% block main %}
+
+
Supplier List
+
+
+
+
+ | Supplier |
+ Quick Links |
+
+
+
+ {% for item in object_list %}
+
+ | {{ item.name }} |
+
+ edit
+ |
+
+ {% endfor %}
+
+
+
+ {% include 'helpers/paginator.html' %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/supplier_update.html b/templates/supplier_update.html
new file mode 100644
index 00000000..92ea3787
--- /dev/null
+++ b/templates/supplier_update.html
@@ -0,0 +1,24 @@
+{% extends 'base.html' %}
+{% block title %}Edit{% endblock %}
+
+{% block main %}
+
+
+ Supplier
+ {% if object %}
+ Edit | {{ object.name }}
+ {% else %}
+ Create
+ {% endif %}
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/urls.py b/urls.py
index cbff5d47..68727f9f 100644
--- a/urls.py
+++ b/urls.py
@@ -16,6 +16,11 @@ urlpatterns = [
path('asset/filter/', views.asset_filter, name='ajax_asset_filter'),
path('asset/update/', views.asset_update, name='ajax_asset_update'),
+ path('supplier/list', views.SupplierList.as_view(), name='supplier_list'),
+ path('supplier/', views.SupplierDetail.as_view(), name='supplier_detail'),
+ path('supplier/create', views.SupplierCreate.as_view(), name='supplier_create'),
+ path('supplier//edit', views.SupplierUpdate.as_view(), name='supplier_update'),
+
path('', include(router.urls)),
]
diff --git a/views.py b/views.py
index 3bc31e4d..77f5e6c6 100644
--- a/views.py
+++ b/views.py
@@ -131,3 +131,27 @@ def asset_filter(request):
return render(request, template_name='asset_update_search_results.html', context=context)
else:
return render(request, template_name='asset_list_table_body.html', context=context)
+
+
+class SupplierList(generic.ListView):
+ model = models.Supplier
+ template_name = 'supplier_list.html'
+ paginate_by = 40
+ ordering = ['name']
+
+
+class SupplierDetail(generic.DetailView):
+ model = models.Supplier
+ template_name = 'supplier_detail.html'
+
+
+class SupplierCreate(generic.CreateView):
+ model = models.Supplier
+ form_class = forms.SupplierForm
+ template_name = 'supplier_update.html'
+
+
+class SupplierUpdate(generic.UpdateView):
+ model = models.Supplier
+ form_class = forms.SupplierForm
+ template_name = 'supplier_update.html'