Distributor lists
This commit is contained in:
parent
e6d68552a1
commit
4b2e8ccabb
2 changed files with 54 additions and 2 deletions
46
inventory/templates/inventory/distributor_list.html
Normal file
46
inventory/templates/inventory/distributor_list.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Distributors{% endblock %}
|
||||
|
||||
{% block header_bar %}
|
||||
Inventory management - Distributors
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="icon">Logo</th>
|
||||
<th>Distributor</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for distributor in object_list %}
|
||||
<tr>
|
||||
<td class="icon">
|
||||
{% if distributor.icon %}
|
||||
<img src="{{ distributor.icon.url }}" title="{{ distributor.name }}">
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'distributor-detail' distributor.id %}" title="{{ distributor.description }}">{{ distributor.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if user.is_staff %}
|
||||
<a class="edit" href="{% url "admin:inventory_distributor_change" object_id=distributor.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_distributor_add" %}?layout=1">Create new distributor...</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 Distributor
|
||||
|
||||
|
||||
class DistributorView(View):
|
||||
pass
|
||||
|
||||
|
||||
class DistributorListView(View):
|
||||
pass
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
class DistributorListView(ListView):
|
||||
model = Distributor
|
||||
|
|
Loading…
Reference in a new issue