Add CourseSession admin model
This commit is contained in:
parent
17eaf80d2c
commit
a119cc122d
|
|
@ -12,9 +12,6 @@ cd client && npm run dev
|
||||||
|
|
||||||
# reset db and run django dev server
|
# reset db and run django dev server
|
||||||
./prepare_server.sh
|
./prepare_server.sh
|
||||||
|
|
||||||
# run tailwind cli (for tailwind support on django templates)
|
|
||||||
cd client && npm run tailwind
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
@ -50,7 +47,7 @@ environment variables.
|
||||||
It will also setup the tables for django and run the django development server.
|
It will also setup the tables for django and run the django development server.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# will initial`migrate` and `runserver` etc...
|
# will run `migrate` and `runserver` etc...
|
||||||
./prepare_server.sh
|
./prepare_server.sh
|
||||||
|
|
||||||
# or async server
|
# or async server
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,37 @@
|
||||||
from django.contrib import admin
|
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",
|
||||||
|
]
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,9 @@ class CourseSession(models.Model):
|
||||||
|
|
||||||
additional_json_data = models.JSONField(default=dict)
|
additional_json_data = models.JSONField(default=dict)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.title}"
|
||||||
|
|
||||||
|
|
||||||
class CourseSessionUser(models.Model):
|
class CourseSessionUser(models.Model):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue