Commit 6a1283d9 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'feature/education-filter-search' into 'master'

Improve education app translation, filtering and searching

See merge request !381
parents 4fde5665 22479ddb
...@@ -15,13 +15,16 @@ admin.site.register(models.Category) ...@@ -15,13 +15,16 @@ admin.site.register(models.Category)
class CourseAdmin(TranslatedModelAdmin): class CourseAdmin(TranslatedModelAdmin):
fields = ('name', 'shorthand', 'course_code', 'ec', 'since', 'until', fields = ('name', 'shorthand', 'course_code', 'ec', 'since', 'until',
'period', 'categories', 'old_courses') 'period', 'categories', 'old_courses')
list_filter = ('categories', 'ec')
search_fields = ('name', 'course_code')
@admin.register(models.Exam) @admin.register(models.Exam)
class ExamAdmin(TranslatedModelAdmin): class ExamAdmin(TranslatedModelAdmin):
list_display = ('type', 'course', 'exam_date', 'uploader', list_display = ('type', 'course', 'exam_date', 'uploader',
'accepted') 'accepted')
list_filter = ('accepted', 'exam_date', 'type') list_filter = ('accepted', 'exam_date', 'type',)
search_fields = ('course', 'uploader',)
actions = ['accept', 'reject'] actions = ['accept', 'reject']
def accept(self, request, queryset): def accept(self, request, queryset):
...@@ -39,6 +42,7 @@ class ExamAdmin(TranslatedModelAdmin): ...@@ -39,6 +42,7 @@ class ExamAdmin(TranslatedModelAdmin):
class SummaryAdmin(TranslatedModelAdmin): class SummaryAdmin(TranslatedModelAdmin):
list_display = ('name', 'course', 'uploader', 'accepted') list_display = ('name', 'course', 'uploader', 'accepted')
list_filter = ('accepted',) list_filter = ('accepted',)
search_fields = ('name', 'course', 'uploader',)
actions = ['accept', 'reject'] actions = ['accept', 'reject']
def accept(self, request, queryset): def accept(self, request, queryset):
......
...@@ -78,7 +78,7 @@ class Course(models.Model, metaclass=ModelTranslateMeta): ...@@ -78,7 +78,7 @@ class Course(models.Model, metaclass=ModelTranslateMeta):
verbose_name_plural = _('courses') verbose_name_plural = _('courses')
class Exam(models.Model): class Exam(models.Model, metaclass=ModelTranslateMeta):
EXAM_TYPES = ( EXAM_TYPES = (
('document', _('Document')), ('document', _('Document')),
('exam', _('Exam')), ('exam', _('Exam')),
...@@ -146,7 +146,7 @@ class Exam(models.Model): ...@@ -146,7 +146,7 @@ class Exam(models.Model):
verbose_name_plural = _('exams') verbose_name_plural = _('exams')
class Summary(models.Model): class Summary(models.Model, metaclass=ModelTranslateMeta):
name = models.CharField( name = models.CharField(
max_length=255, max_length=255,
verbose_name=_('summary name'), verbose_name=_('summary name'),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment