Add Student.supervisor and mentor
This commit is contained in:
parent
f5a2e7f1ab
commit
fa96b75e9f
3 changed files with 34 additions and 1 deletions
|
|
@ -95,6 +95,7 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
ordering = ('last_name', 'first_name')
|
||||
list_filter = (('archived', ArchivedListFilter), ('klass', KlassRelatedListFilter))
|
||||
search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass__name')
|
||||
autocomplete_fields = ('corporation', 'instructor', 'supervisor', 'mentor')
|
||||
readonly_fields = ('report_sem1_sent', 'report_sem2_sent')
|
||||
fields = (('last_name', 'first_name', 'ext_id'), ('street', 'pcode', 'city', 'district'),
|
||||
('email', 'tel', 'mobile'), ('gender', 'avs', 'birth_date'),
|
||||
|
|
@ -102,7 +103,7 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
('klass', 'option_ase'),
|
||||
('report_sem1', 'report_sem1_sent'),
|
||||
('report_sem2', 'report_sem2_sent'),
|
||||
('corporation', 'instructor'))
|
||||
('corporation', 'instructor', 'supervisor', 'mentor'))
|
||||
actions = ['archive']
|
||||
|
||||
def archive(self, request, queryset):
|
||||
|
|
@ -130,6 +131,9 @@ class CorpContactAdmin(admin.ModelAdmin):
|
|||
form.base_fields['sections'].widget.can_add_related = False
|
||||
return form
|
||||
|
||||
def get_search_results(self, request, qs, term):
|
||||
qs, distinct = super().get_search_results(request, qs, term)
|
||||
return qs.exclude(archived=True), distinct
|
||||
|
||||
class ContactInline(admin.StackedInline):
|
||||
model = CorpContact
|
||||
|
|
@ -152,6 +156,10 @@ class CorporationAdmin(admin.ModelAdmin):
|
|||
'street', ('pcode', 'city'), ('tel', 'email'), 'web', 'archived')
|
||||
inlines = [ContactInline]
|
||||
|
||||
def get_search_results(self, request, qs, term):
|
||||
qs, distinct = super().get_search_results(request, qs, term)
|
||||
return qs.exclude(archived=True), distinct
|
||||
|
||||
|
||||
class AvailabilityAdminForm(forms.ModelForm):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue