Commit dc2ad35becc02271bf9101acd007cd8a14711c57
1 parent
f38bdc9f
Exists in
master
and in
5 other branches
updatins course forms
Showing
3 changed files
with
16 additions
and
6 deletions
Show diff stats
courses/forms.py
courses/templates/topic/index.html
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | <div class="panel panel-default"> |
75 | 75 | <div class="panel-body"> |
76 | 76 | {% for activit in activitys %} |
77 | - <form class="form-horizontal"> | |
77 | + <form class="form-horizontal" enctype='multipart/form-data'>{% csrf_token %} | |
78 | 78 | <fieldset> |
79 | 79 | <legend>{{activit.name}}</legend> |
80 | 80 | |
... | ... | @@ -107,9 +107,15 @@ |
107 | 107 | <input type="number" step="0.01"> |
108 | 108 | </div> |
109 | 109 | {% else %} |
110 | - <div class="col-md-4"> | |
111 | - <input type="file" name="arquivos" class="btn btn-success" multiple/> | |
110 | + <div class="col-md-4"> | |
111 | + <input type="hidden" name="id" value=""> | |
112 | + <input type="hidden" name="student" value=""> | |
113 | + <div class="form-group {% if form.pdf.errors %} has-error {% endif %}"> | |
114 | + <label for="id_pdf">PDF</label> | |
115 | + {{form.pdf}} | |
112 | 116 | </div> |
117 | + <button type="submit" class="btn btn-success" id="send_button">Enviar</button> | |
118 | + </div> | |
113 | 119 | {% endif %} |
114 | 120 | </div> |
115 | 121 | </div> | ... | ... |
courses/views.py
... | ... | @@ -11,7 +11,7 @@ from rolepermissions.verifications import has_role |
11 | 11 | from django.db.models import Q |
12 | 12 | from rolepermissions.verifications import has_object_permission |
13 | 13 | |
14 | -from .forms import CourseForm, UpdateCourseForm, CategoryForm, SubjectForm,TopicForm | |
14 | +from .forms import CourseForm, UpdateCourseForm, CategoryForm, SubjectForm,TopicForm,ActivityForm | |
15 | 15 | from .models import Course, Subject, Category,Topic, SubjectCategory,Activity |
16 | 16 | from core.mixins import NotificationMixin |
17 | 17 | from users.models import User |
... | ... | @@ -292,12 +292,17 @@ class TopicsView(LoginRequiredMixin, generic.ListView): |
292 | 292 | context = super(TopicsView, self).get_context_data(**kwargs) |
293 | 293 | activitys = Activity.objects.filter(topic__name = topic.name) |
294 | 294 | students_activit = User.objects.filter(activities = Activity.objects.all()) |
295 | + # page_user = User.objects.get(id= self.kwargs['user_id']) | |
295 | 296 | context['topic'] = topic |
296 | 297 | context['subject'] = topic.subject |
297 | 298 | context['activitys'] = activitys |
298 | 299 | context['students_activit'] = students_activit |
300 | + context['form'] = ActivityForm | |
301 | + # context['user_activity_id'] = Activity.objects.filter(students__id = self.kwargs['students_id']) | |
302 | + # context['page_user'] = page_user | |
299 | 303 | return context |
300 | 304 | |
305 | + | |
301 | 306 | class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.edit.CreateView): |
302 | 307 | |
303 | 308 | allowed_roles = ['professor', 'system_admin'] |
... | ... | @@ -342,7 +347,7 @@ class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): |
342 | 347 | return super(UpdateTopicView, self).dispatch(*args, **kwargs) |
343 | 348 | |
344 | 349 | def get_object(self, queryset=None): |
345 | - return get_object_or_404(Topic, slug = self.kwargs.get('slug')) | |
350 | + return get_object_or_404(Topic, slug = self.kwargs.get('slug')) | |
346 | 351 | |
347 | 352 | def get_success_url(self): |
348 | 353 | return reverse_lazy('course:view_subject', kwargs={'slug' : self.object.subject.slug}) | ... | ... |