Add CourseSession admin model

This commit is contained in:
Daniel Egger 2022-11-07 16:48:58 +01:00
parent 17eaf80d2c
commit a119cc122d
3 changed files with 39 additions and 5 deletions

View File

@ -12,9 +12,6 @@ cd client && npm run dev
# reset db and run django dev server
./prepare_server.sh
# run tailwind cli (for tailwind support on django templates)
cd client && npm run tailwind
```
## Installation
@ -50,7 +47,7 @@ environment variables.
It will also setup the tables for django and run the django development server.
```bash
# will initial`migrate` and `runserver` etc...
# will run `migrate` and `runserver` etc...
./prepare_server.sh
# or async server

View File

@ -1,3 +1,37 @@
from django.contrib import admin
# Register your models here.
from vbv_lernwelt.course.models import CourseSession, CourseSessionUser
@admin.register(CourseSession)
class CourseSessionAdmin(admin.ModelAdmin):
date_hierarchy = "created_at"
list_display = [
"title",
"course",
"start_date",
"end_date",
"created_at",
"updated_at",
]
@admin.register(CourseSessionUser)
class CourseSessionUserAdmin(admin.ModelAdmin):
date_hierarchy = "created_at"
list_display = [
"course_session",
"user",
"created_at",
"updated_at",
]
search_fields = [
"user__first_name",
"user__last_name",
"user__email",
"course_session__title",
]
list_filter = [
"course_session__course",
"course_session",
]

View File

@ -182,6 +182,9 @@ class CourseSession(models.Model):
additional_json_data = models.JSONField(default=dict)
def __str__(self):
return f"{self.title}"
class CourseSessionUser(models.Model):
"""