|
@@ -1,3 +1,23 @@
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
+
|
|
|
+from __future__ import unicode_literals
|
|
|
from django.contrib import admin
|
|
|
+from .models import ItemType, Item, Loan
|
|
|
+
|
|
|
+
|
|
|
+admin.site.register(ItemType)
|
|
|
+
|
|
|
+
|
|
|
+@admin.register(Item)
|
|
|
+class ItemAdmin(admin.ModelAdmin):
|
|
|
+ list_display = ('type', 'designation', 'mac_address', 'user_in_charge',
|
|
|
+ 'buy_date', 'is_available')
|
|
|
+ list_filter = ('type__name', 'buy_date')
|
|
|
+ search_fields = ('designation', 'user_in_charge')
|
|
|
+
|
|
|
|
|
|
-# Register your models here.
|
|
|
+@admin.register(Loan)
|
|
|
+class LoanAdmin(admin.ModelAdmin):
|
|
|
+ list_display = ('item', 'user', 'loan_date', 'loan_date_end', 'location')
|
|
|
+ list_filter = ('item__designation', 'user__username')
|
|
|
+ search_fields = ('item', 'user')
|