summaryrefslogtreecommitdiff
path: root/procurement/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'procurement/admin.py')
-rw-r--r--procurement/admin.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/procurement/admin.py b/procurement/admin.py
index 993b1b5..f35d706 100644
--- a/procurement/admin.py
+++ b/procurement/admin.py
@@ -2,13 +2,23 @@ from django.contrib import admin
from django.shortcuts import render_to_response, get_object_or_404
from procurement.admin_forms import ComponentAdminForm
-from procurement.models import Supplier, Component
+from procurement.models import Supplier, Component, Representative
+class RepresentativeAdmin(admin.ModelAdmin):
+ list_display = ('name', 'email', 'supplier', 'updated')
+ ordering = ("supplier",)
+
+class RepresentativeInline(admin.TabularInline):
+ model = Representative
class SupplierAdmin(admin.ModelAdmin):
- list_display = ('name', 'representative_name', 'representative_email', 'is_authorized', 'updated')
+ list_display = ('name', 'get_representatives', 'is_authorized', 'updated')
filter_horizonal = ('components',)
+ inlines = [RepresentativeInline]
+ def get_representatives(self, obj):
+ return list(str(x) for x in obj.representatives.all())
+ get_representatives.short_description = "Representatives"
class ComponentAdmin(admin.ModelAdmin):
list_display = ('name', 'sku', 'updated')
@@ -27,5 +37,6 @@ class ComponentAdmin(admin.ModelAdmin):
})
+admin.site.register(Representative, RepresentativeAdmin)
admin.site.register(Supplier, SupplierAdmin)
admin.site.register(Component, ComponentAdmin)