Manufacturer lists
This commit is contained in:
parent
4b2e8ccabb
commit
37388ba7be
2 changed files with 53 additions and 2 deletions
45
inventory/templates/inventory/manufacturer_list.html
Normal file
45
inventory/templates/inventory/manufacturer_list.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Manufacturers{% endblock %}
|
||||
|
||||
{% block header_bar %}
|
||||
Inventory management - Manufacturers
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Logo</th>
|
||||
<th>Manufacturer</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for manufacturer in object_list %}
|
||||
<tr>
|
||||
<td class="logo">
|
||||
{% if manufacturer.icon %}
|
||||
<img src="{{ manufacturer.icon.url }}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'manufacturer-detail' manufacturer.id %}" title="{{ manufacturer.description }}">{{ manufacturer.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if user.is_staff %}
|
||||
<a class="edit" href="{% url "admin:inventory_manufacturer_change" object_id=manufacturer.pk %}"><img class="icon" src="{% static 'inventory/img/edit.svg' %}"></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if user.is_staff %}
|
||||
<p><a href="{% url "admin:inventory_manufacturer_add" %}?layout=1">Create new manufacturer...</a></p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %}
|
|
@ -1,9 +1,15 @@
|
|||
from django.views import View
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import ListView, DetailView
|
||||
|
||||
from inventory.models import Manufacturer
|
||||
|
||||
|
||||
class ManufacturerView(View):
|
||||
pass
|
||||
|
||||
|
||||
class ManufacturerListView(View):
|
||||
pass
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
class ManufacturerListView(ListView):
|
||||
model = Manufacturer
|
||||
|
|
Loading…
Reference in a new issue