Add team admin
This commit is contained in:
parent
3c85ab6520
commit
a43dffc7f7
|
|
@ -170,7 +170,6 @@ class CreateSnapshotTestCase(SkillboxTestCase):
|
||||||
})
|
})
|
||||||
self._test_create_snapshot(result)
|
self._test_create_snapshot(result)
|
||||||
|
|
||||||
|
|
||||||
def test_create_two_snapshots(self):
|
def test_create_two_snapshots(self):
|
||||||
self.client.execute(CREATE_SNAPSHOT_MUTATION, variables={
|
self.client.execute(CREATE_SNAPSHOT_MUTATION, variables={
|
||||||
'input': {
|
'input': {
|
||||||
|
|
@ -186,7 +185,6 @@ class CreateSnapshotTestCase(SkillboxTestCase):
|
||||||
})
|
})
|
||||||
self._test_create_snapshot(result, num_snapshots=2)
|
self._test_create_snapshot(result, num_snapshots=2)
|
||||||
|
|
||||||
|
|
||||||
def test_apply_snapshot(self):
|
def test_apply_snapshot(self):
|
||||||
self.snapshot = Snapshot.objects.create_snapshot(module=self.module, school_class=self.skillbox_class,
|
self.snapshot = Snapshot.objects.create_snapshot(module=self.module, school_class=self.skillbox_class,
|
||||||
user=self.teacher)
|
user=self.teacher)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from django.contrib import admin
|
||||||
from django.contrib.auth.admin import UserAdmin
|
from django.contrib.auth.admin import UserAdmin
|
||||||
|
|
||||||
from users.forms import CustomUserCreationForm, CustomUserChangeForm
|
from users.forms import CustomUserCreationForm, CustomUserChangeForm
|
||||||
from .models import User, SchoolClass, Role, UserRole, UserSetting, License, UserData
|
from .models import User, SchoolClass, Role, UserRole, UserSetting, License, UserData, Team
|
||||||
|
|
||||||
|
|
||||||
class SchoolClassInline(admin.TabularInline):
|
class SchoolClassInline(admin.TabularInline):
|
||||||
|
|
@ -51,6 +51,7 @@ class CustomUserAdmin(UserAdmin):
|
||||||
list_filter = ('school_classes', 'is_superuser')
|
list_filter = ('school_classes', 'is_superuser')
|
||||||
ordering = ['pk']
|
ordering = ['pk']
|
||||||
search_fields = ('username', 'first_name', 'last_name')
|
search_fields = ('username', 'first_name', 'last_name')
|
||||||
|
autocomplete_fields = ('team',)
|
||||||
|
|
||||||
inlines = [
|
inlines = [
|
||||||
SchoolClassInline,
|
SchoolClassInline,
|
||||||
|
|
@ -86,3 +87,13 @@ class UserDataAdmin(admin.ModelAdmin):
|
||||||
list_display = ('user', 'accepted_terms')
|
list_display = ('user', 'accepted_terms')
|
||||||
list_filter = ('accepted_terms',)
|
list_filter = ('accepted_terms',)
|
||||||
raw_id_fields = ('user',)
|
raw_id_fields = ('user',)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Team)
|
||||||
|
class TeamAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'creator', 'member_list',)
|
||||||
|
readonly_fields = ('member_list',)
|
||||||
|
search_fields = ('name', 'creator__first_name', 'creator__last_name')
|
||||||
|
|
||||||
|
def member_list(self, obj):
|
||||||
|
return ', '.join([member.full_name for member in obj.members.all()])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue