Commit 4934aa87e202b69e854343e8b098e61167914c3a

Authored by ailsoncgt
1 parent 0a34fa4d

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,6 +16,7 @@ from .forms import CourseForm, UpdateCourseForm, CategoryCourseForm, SubjectForm
16 from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity 16 from .models import Course, Subject, CourseCategory,Topic, SubjectCategory,Activity
17 from core.mixins import NotificationMixin 17 from core.mixins import NotificationMixin
18 from users.models import User 18 from users.models import User
  19 +from files.forms import FileForm
19 20
20 from datetime import date 21 from datetime import date
21 22
@@ -303,6 +304,7 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): @@ -303,6 +304,7 @@ class SubjectsView(LoginRequiredMixin, generic.ListView):
303 context = super(SubjectsView, self).get_context_data(**kwargs) 304 context = super(SubjectsView, self).get_context_data(**kwargs)
304 context['course'] = subject.course 305 context['course'] = subject.course
305 context['subject'] = subject 306 context['subject'] = subject
  307 + context['form_file'] = FileForm
306 context['topics'] = Topic.objects.filter(subject = subject) 308 context['topics'] = Topic.objects.filter(subject = subject)
307 return context 309 return context
308 310
files/forms.py 0 → 100644
@@ -0,0 +1,9 @@ @@ -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 \ No newline at end of file 10 \ No newline at end of file