Renamed Project to cntmanage
This commit is contained in:
16
cntmanage/flightslot/admins/course_adm.py
Normal file
16
cntmanage/flightslot/admins/course_adm.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.contrib import admin
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from ..models.courses import Course
|
||||
from ..custom.colortag import course_color
|
||||
|
||||
class CourseAdmin(admin.ModelAdmin):
|
||||
list_display = ("ctype", "cnumber","color_display", "year")
|
||||
list_filter = ("ctype", "year")
|
||||
|
||||
# Dinamically add color_display property to show a colored dot
|
||||
@admin.display(description="Color")
|
||||
def color_display(self, obj: Course) -> SafeText:
|
||||
if not obj.pk:
|
||||
return SafeText("")
|
||||
return course_color(obj.color)
|
||||
Reference in New Issue
Block a user