Commit 565aa5c7 authored by Daniel STAN's avatar Daniel STAN

impressions: ne plante pas si pas de printer

parent fab373b2
......@@ -20,7 +20,9 @@
</div>
<footer>
<a href="{% url 'impressions:gestion' %}" class="button">Liste des tâches</a>
<a href="{% url 'impressions:printer' printer_pk %}" class="button">Statut de l'imprimante</a>
{% for printer in printers %}
<a href="{{ printer.get_absolute_url }}" class="button">Statut de l'imprimante</a>
{% endfor %}
<input type="submit" class="button-add" value="Envoyer" name="SubmitUploadForm"/>
</footer>
</form>
......
......@@ -143,7 +143,7 @@ def view(request):
return render(request, "impressions/impressions.html", {
'uploadform': uploadform,
'clubform' : clubform,
'printer_pk': Printer.objects.get(domain_name="imprimante.adm.crans.org").pk,
'printers': Printer.objects.all(),
})
else:
if "SubmitUploadForm" in request.POST.keys():
......
from django.contrib import admin
import models
# Register your models here.
admin.site.register(models.Printer)
from django.db import models
from django.core.urlresolvers import reverse
from snimpy.manager import Manager
from snimpy.manager import load
......@@ -7,7 +9,7 @@ class Printer(models.Model):
('???', 1),
('running', 2),
('warning', 3),
)
)
name = models.CharField(max_length=255, editable=False)
domain_name = models.CharField(max_length=255, unique=True)
status = models.PositiveSmallIntegerField(editable=False, choices=STATUS_CHOICES)
......@@ -62,6 +64,9 @@ class Printer(models.Model):
def __unicode__(self):
return self.name
def get_absolute_url(self):
"""Url vers la view principale d'affichage"""
return reverse('impressions:printer', args=[str(self.pk)])
class PaperTray(models.Model):
snmp_id = models.PositiveSmallIntegerField(editable=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment