Premier jet d'une contrib de gestion de matériels pour a-d-u.
[progfou.git] / gestionmateriel / materiel / admin.py
1 # -*- coding: utf-8 -*-
2 from django.contrib import admin
3 from django import forms
4 from models import *
5
6 class MyMachineAdminForm(forms.ModelForm):
7 class Meta:
8 model = Machine
9
10 def clean_adresse_mac(self):
11 return self.cleaned_data['adresse_mac'].lower()
12
13 class MachineAdmin(admin.ModelAdmin):
14 form = MyMachineAdminForm
15 list_display = ['nom_dns_complet', 'adresse_ip', 'adresse_mac', 'categorie', 'emplacement']
16 list_filter = ['emplacement', 'categorie']
17
18 admin.site.register(Categorie)
19 admin.site.register(Machine, MachineAdmin)