Commit 4934aa87e202b69e854343e8b098e61167914c3a
1 parent
0a34fa4d
Exists in
master
and in
5 other branches
Add form class in topic template and forms.py to app #180
Showing
2 changed files
with
11 additions
and
0 deletions
Show diff stats
courses/views.py
... | ... | @@ -16,6 +16,7 @@ from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm |
16 | 16 | from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity |
17 | 17 | from core.mixins import NotificationMixin |
18 | 18 | from users.models import User |
19 | +from files.forms import FileForm | |
19 | 20 | |
20 | 21 | from datetime import date |
21 | 22 | |
... | ... | @@ -303,6 +304,7 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): |
303 | 304 | context = super(SubjectsView, self).get_context_data(**kwargs) |
304 | 305 | context['course'] = subject.course |
305 | 306 | context['subject'] = subject |
307 | + context['form_file'] = FileForm | |
306 | 308 | context['topics'] = Topic.objects.filter(subject = subject) |
307 | 309 | return context |
308 | 310 | ... | ... |
... | ... | @@ -0,0 +1,9 @@ |
1 | +from django import forms | |
2 | +from .models import TopicFile | |
3 | +from django.utils.translation import ugettext_lazy as _ | |
4 | + | |
5 | +class FileForm(forms.ModelForm): | |
6 | + | |
7 | + class Meta: | |
8 | + model = TopicFile | |
9 | + fields = ['name', 'file_url'] | |
0 | 10 | \ No newline at end of file | ... | ... |