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
6e3701ec
Commit
6e3701ec
authored
Apr 16, 2021
by
Glaucia S. Santos
Browse files
New file name field
parent
0464c091
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
courses/course_material/models.py
courses/course_material/models.py
+6
-1
courses/migrations/0024_auto_20210416_1715.py
courses/migrations/0024_auto_20210416_1715.py
+48
-0
courses/translation.py
courses/translation.py
+9
-0
No files found.
courses/course_material/models.py
View file @
6e3701ec
...
...
@@ -28,7 +28,12 @@ def get_upload_path(instance, filename):
class
File
(
models
.
Model
):
# title = models.CharField(_('Title'), max_length=255)
title
=
models
.
CharField
(
_
(
'Title'
),
max_length
=
255
,
blank
=
True
,
null
=
True
)
file
=
models
.
FileField
(
upload_to
=
get_upload_path
,
)
...
...
courses/migrations/0024_auto_20210416_1715.py
0 → 100644
View file @
6e3701ec
# Generated by Django 2.2.20 on 2021-04-16 20:15
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'courses'
,
'0023_auto_20210412_1852'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'coursematerial'
,
name
=
'text_en'
,
field
=
models
.
TextField
(
null
=
True
,
verbose_name
=
'Question'
),
),
migrations
.
AddField
(
model_name
=
'coursematerial'
,
name
=
'text_es'
,
field
=
models
.
TextField
(
null
=
True
,
verbose_name
=
'Question'
),
),
migrations
.
AddField
(
model_name
=
'coursematerial'
,
name
=
'text_pt_br'
,
field
=
models
.
TextField
(
null
=
True
,
verbose_name
=
'Question'
),
),
migrations
.
AddField
(
model_name
=
'file'
,
name
=
'title'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'Title'
),
),
migrations
.
AddField
(
model_name
=
'file'
,
name
=
'title_en'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'Title'
),
),
migrations
.
AddField
(
model_name
=
'file'
,
name
=
'title_es'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'Title'
),
),
migrations
.
AddField
(
model_name
=
'file'
,
name
=
'title_pt_br'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'Title'
),
),
]
courses/translation.py
View file @
6e3701ec
from
modeltranslation.translator
import
register
,
TranslationOptions
from
.models
import
Course
,
Lesson
,
Unit
from
.course_material.models
import
CourseMaterial
,
File
@
register
(
Course
)
...
...
@@ -18,3 +19,11 @@ class LessonTranslationOptions(TranslationOptions):
@
register
(
Unit
)
class
UnitTranslationOptions
(
TranslationOptions
):
fields
=
(
'title'
,
'video'
,
'side_notes'
,
'chat_room'
)
@
register
(
CourseMaterial
)
class
UnitTranslationOptions
(
TranslationOptions
):
fields
=
(
'text'
,)
@
register
(
File
)
class
UnitTranslationOptions
(
TranslationOptions
):
fields
=
(
'title'
,)
\ No newline at end of file
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