Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
be68cbd0
Commit
be68cbd0
authored
Feb 04, 2021
by
Matheus Miranda
Browse files
Add CourseTrack admin
parent
b3de967e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
courses/admin.py
courses/admin.py
+12
-2
courses/models.py
courses/models.py
+9
-0
No files found.
courses/admin.py
View file @
be68cbd0
...
...
@@ -7,8 +7,8 @@ from .videos.models import Video
from
.models
import
(
Course
,
Lesson
,
Unit
,
CourseProfessor
,
CourseStudent
,
StudentProgress
,
Class
,
ProfessorMessage
,
Course
Author
,
ProfessorMessage
,
CourseAuthor
,
Course
Category
,
CourseTrack
,
)
from
.course_material.models
import
CourseMaterial
,
File
...
...
@@ -36,6 +36,14 @@ class CourseAdmin(admin.ModelAdmin):
]
@
admin
.
register
(
CourseTrack
)
class
CourseTrackAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'home_position'
)
filter_horizontal
=
[
'courses'
,
]
class
UnitInline
(
admin
.
TabularInline
):
model
=
Unit
fields
=
(
'title'
,
'video'
,
'position'
,)
...
...
@@ -151,3 +159,5 @@ class ClassroomAdmin(admin.ModelAdmin):
'group__name'
,
'assistants__name'
,
)
admin
.
site
.
register
(
CourseCategory
)
courses/models.py
View file @
be68cbd0
...
...
@@ -35,10 +35,15 @@ class CourseCategory(models.Model):
color
=
models
.
CharField
(
_
(
"color"
),
max_length
=
7
,
blank
=
True
,
help_text
=
_
(
"Title color in hex format (i.e: #1aafd0)."
))
class
Meta
:
verbose_name
=
_
(
'Course Category'
)
verbose_name_plural
=
_
(
'Course Categories'
)
def
__str__
(
self
):
return
self
.
name
class
Course
(
models
.
Model
):
STATES
=
(
(
'draft'
,
_
(
'Draft'
)),
...
...
@@ -343,6 +348,10 @@ class CourseTrack(models.Model):
verbose_name
=
'courses'
,
blank
=
True
,
)
home_position
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
)
class
Meta
:
verbose_name
=
_
(
'Course Track'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment