X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/01e3154575d718ae51e55e7ea8d064718e7d0037..309ec8b919d57858254b78cd7ba3b4d84d90da9a:/src/team/admin.py?ds=sidebyside

diff --git a/src/team/admin.py b/src/team/admin.py
index cff63219..6bdca87e 100644
--- a/src/team/admin.py
+++ b/src/team/admin.py
@@ -1,13 +1,28 @@
 from django.contrib import admin
+from django.contrib.auth.admin import UserAdmin
+from django.contrib.auth.models import User
 from . import models
 
 
-@admin.register(models.Profile)
-class ProfileAdmin(admin.ModelAdmin):
-    list_display = ['user', 'presence']
+class ProfileInline(admin.StackedInline):
+    model = models.Profile
+    can_delete = False
+
+
+class CustomUserAdmin(UserAdmin):
+    inlines = (ProfileInline, )
+
+    def get_inline_instances(self, request, obj=None):
+        if not obj:
+            return list()
+        return super(CustomUserAdmin, self).get_inline_instances(request, obj)
+
+admin.site.unregister(User)
+admin.site.register(User, CustomUserAdmin)
 
 
 @admin.register(models.Presence)
-class ProfileAdmin(admin.ModelAdmin):
-    list_display = ['user', 'timestamp', 'active']
+class PresenceAdmin(admin.ModelAdmin):
+    list_display = ['session_key', 'chunk', 'user', 'since', 'until', 'active']
+    raw_id_fields = ['chunk', 'user']