Commit 344859b6ebdd91a7a7730c2e195849ea9472010f
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
6 changed files
with
182 additions
and
138 deletions
Show diff stats
courses/forms.py
| ... | ... | @@ -42,16 +42,11 @@ class CourseForm(forms.ModelForm): |
| 42 | 42 | raise forms.ValidationError(_('The end date may not be before the start date.')) |
| 43 | 43 | return end_date |
| 44 | 44 | |
| 45 | - # init_register_date = forms.DateField(widget=forms.DateField) | |
| 46 | - # end_register_date = forms.DateField(widget=forms.DateField) | |
| 47 | - # init_date = forms.DateField(widget=forms.DateField) | |
| 48 | - # end_date = forms.DateField(widget=forms.DateField) | |
| 49 | - | |
| 50 | 45 | |
| 51 | 46 | class Meta: |
| 52 | 47 | model = Course |
| 53 | 48 | fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date', |
| 54 | - 'init_date', 'end_date', 'category', 'coordenator') | |
| 49 | + 'init_date', 'end_date', 'category', 'coordenator','public') | |
| 55 | 50 | labels = { |
| 56 | 51 | 'name': _('Name'), |
| 57 | 52 | 'objectivies': _('Objectives'), |
| ... | ... | @@ -61,8 +56,9 @@ class CourseForm(forms.ModelForm): |
| 61 | 56 | 'end_register_date': _('Course registration end date'), |
| 62 | 57 | 'init_date': _('Course start date'), |
| 63 | 58 | 'end_date': _('Course end date'), |
| 64 | - 'category': _('CourseCategory'), | |
| 59 | + 'category': _('Category'), | |
| 65 | 60 | 'coordenator': _('Coordenator'), |
| 61 | + 'public':_('Public'), | |
| 66 | 62 | } |
| 67 | 63 | help_texts = { |
| 68 | 64 | 'name': _('Course name'), |
| ... | ... | @@ -75,16 +71,42 @@ class CourseForm(forms.ModelForm): |
| 75 | 71 | 'end_date': _('Date that the course ends (dd/mm/yyyy)'), |
| 76 | 72 | 'category': _('CourseCategory which the course belongs'), |
| 77 | 73 | 'coordenator': _('Course Coordenator'), |
| 74 | + 'public':_('To define if the course can be accessed by people not registered'), | |
| 78 | 75 | } |
| 79 | 76 | |
| 80 | 77 | widgets = { |
| 81 | - 'categoy': forms.Select(), | |
| 78 | + 'ategoy': forms.Select(), | |
| 82 | 79 | 'coordenator': forms.Select(), |
| 83 | - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), | |
| 84 | - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), | |
| 80 | + 'content': SummernoteWidget(), | |
| 81 | + 'objectivies': SummernoteWidget(), | |
| 85 | 82 | } |
| 86 | 83 | |
| 87 | 84 | class UpdateCourseForm(CourseForm): |
| 85 | + | |
| 86 | + def clean_end_register_date(self): | |
| 87 | + init_register_date = self.cleaned_data['init_register_date'] | |
| 88 | + end_register_date = self.cleaned_data['end_register_date'] | |
| 89 | + | |
| 90 | + if init_register_date and end_register_date and end_register_date < init_register_date: | |
| 91 | + raise forms.ValidationError(_('The end date may not be before the start date.')) | |
| 92 | + return end_register_date | |
| 93 | + | |
| 94 | + def clean_init_date(self): | |
| 95 | + end_register_date = self.cleaned_data['end_register_date'] | |
| 96 | + init_date = self.cleaned_data['init_date'] | |
| 97 | + | |
| 98 | + if end_register_date and init_date and init_date <= end_register_date: | |
| 99 | + raise forms.ValidationError(_('The course start date must be after the end of registration.')) | |
| 100 | + return init_date | |
| 101 | + | |
| 102 | + def clean_end_date(self): | |
| 103 | + init_date = self.cleaned_data['init_date'] | |
| 104 | + end_date = self.cleaned_data['end_date'] | |
| 105 | + | |
| 106 | + if init_date and end_date and end_date < init_date: | |
| 107 | + raise forms.ValidationError(_('The end date may not be before the start date.')) | |
| 108 | + return end_date | |
| 109 | + | |
| 88 | 110 | def __init__(self, *args, **kwargs): |
| 89 | 111 | super(UpdateCourseForm, self).__init__(*args, **kwargs) |
| 90 | 112 | self.fields["students"].required = False |
| ... | ... | @@ -92,7 +114,7 @@ class UpdateCourseForm(CourseForm): |
| 92 | 114 | class Meta: |
| 93 | 115 | model = Course |
| 94 | 116 | fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date', |
| 95 | - 'init_date', 'end_date', 'category','students', 'coordenator') | |
| 117 | + 'init_date', 'end_date', 'category','students', 'coordenator','public') | |
| 96 | 118 | labels = { |
| 97 | 119 | 'name': _('Name'), |
| 98 | 120 | 'objectivies': _('Objectives'), |
| ... | ... | @@ -102,9 +124,10 @@ class UpdateCourseForm(CourseForm): |
| 102 | 124 | 'end_register_date': _('Course registration end date'), |
| 103 | 125 | 'init_date': _('Course start date'), |
| 104 | 126 | 'end_date': _('Course end date'), |
| 105 | - 'category': _('CourseCategory'), | |
| 127 | + 'category': _('Category'), | |
| 106 | 128 | 'coordenator': _('Coordenator'), |
| 107 | 129 | 'students': _('Student'), |
| 130 | + 'public':_('Public'), | |
| 108 | 131 | } |
| 109 | 132 | help_texts = { |
| 110 | 133 | 'name': _('Course name'), |
| ... | ... | @@ -118,12 +141,13 @@ class UpdateCourseForm(CourseForm): |
| 118 | 141 | 'category': _('CourseCategory which the course belongs'), |
| 119 | 142 | 'coordenator': _('Course Coordenator'), |
| 120 | 143 | 'students': _("Course's Students"), |
| 144 | + 'public':_('To define if the course can be accessed by people not registered'), | |
| 121 | 145 | } |
| 122 | 146 | widgets = { |
| 123 | 147 | 'categoy': forms.Select(), |
| 124 | 148 | 'coordenator': forms.Select(), |
| 125 | - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), | |
| 126 | - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}), | |
| 149 | + 'content': SummernoteWidget(), | |
| 150 | + 'objectivies': SummernoteWidget(), | |
| 127 | 151 | } |
| 128 | 152 | |
| 129 | 153 | class SubjectForm(forms.ModelForm): | ... | ... |
courses/templates/course/create.html
| ... | ... | @@ -17,10 +17,17 @@ |
| 17 | 17 | {% csrf_token %} |
| 18 | 18 | {% for field in form %} |
| 19 | 19 | <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> |
| 20 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 20 | + {% if field.auto_id != 'id_public' %} | |
| 21 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 22 | + {% endif %} | |
| 21 | 23 | {% if field.auto_id == 'id_init_register_date' or field.auto_id == 'id_end_register_date' or field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%} |
| 22 | 24 | <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> |
| 23 | - | |
| 25 | + {% elif field.auto_id == 'id_public' %} | |
| 26 | + <div class="checkbox"> | |
| 27 | + <label> | |
| 28 | + <input type="checkbox" name="{{field.name}}" {% if field.value %}checked="checked"{% endif %}><span class="checkbox-material"></span> {{field.name}} | |
| 29 | + </label> | |
| 30 | + </div> | |
| 24 | 31 | {% else %} |
| 25 | 32 | {% render_field field class='form-control' %} |
| 26 | 33 | {% endif %} |
| ... | ... | @@ -49,6 +56,8 @@ |
| 49 | 56 | </div> |
| 50 | 57 | </div> |
| 51 | 58 | </br> |
| 59 | +</br> | |
| 60 | +</br> | |
| 52 | 61 | <script type="text/javascript"> |
| 53 | 62 | var locale = navigator.language || navigator.userLanguage; |
| 54 | 63 | ... | ... |
courses/templates/course/replicate.html
| 1 | 1 | {% extends 'course/view.html' %} |
| 2 | 2 | |
| 3 | 3 | {% load static i18n %} |
| 4 | -{% load widget_tweaks %} | |
| 4 | +{% load widget_tweaks course_value_field %} | |
| 5 | 5 | |
| 6 | 6 | {% block breadcrumbs %} |
| 7 | 7 | <ol class="breadcrumb"> |
| ... | ... | @@ -12,131 +12,79 @@ |
| 12 | 12 | |
| 13 | 13 | {% block content %} |
| 14 | 14 | <div class="card card-content"> |
| 15 | - <div class="card-body"> | |
| 15 | + <div class="card-body"> | |
| 16 | 16 | <form method="post" action="" enctype="multipart/form-data"> |
| 17 | 17 | {% csrf_token %} |
| 18 | - <div class="form-group is-fileinput"> | |
| 19 | - <label for="id_name">{% trans 'Name' %}</label> | |
| 20 | - | |
| 21 | - | |
| 22 | - <input class="form-control" id="id_name" maxlength="100" name="name" type="text" required="" value="{{course.name}}"> | |
| 23 | - | |
| 24 | - <span class="help-block">{% trans 'Course name' %}</span> | |
| 25 | - | |
| 26 | - </div> | |
| 27 | - | |
| 28 | - <div class="form-group is-fileinput"> | |
| 29 | - <label for="id_objectivies">{% trans 'Objectives' %}</label> | |
| 30 | - | |
| 31 | - <textarea class="form-control" cols="80" id="id_objectivies" name="objectivies" rows="5">{{ course.objectivies }}</textarea> | |
| 32 | - | |
| 33 | - <span class="help-block">{% trans 'Course objective' %}</span> | |
| 34 | - | |
| 35 | - </div> | |
| 36 | - | |
| 37 | - <div class="form-group is-fileinput"> | |
| 38 | - <label for="id_content">{% trans 'Content' %}</label> | |
| 39 | - | |
| 40 | - | |
| 41 | - <textarea class="form-control" cols="80" id="id_content" name="content" rows="5">{{course.content}}</textarea> | |
| 42 | - | |
| 43 | - <span class="help-block">{% trans 'Course modules' %}</span> | |
| 44 | - | |
| 45 | - </div> | |
| 46 | - | |
| 47 | - <div class="form-group is-fileinput"> | |
| 48 | - <label for="id_max_students">{% trans 'Number of studets maximum' %}</label> | |
| 49 | - | |
| 50 | - | |
| 51 | - <input class="form-control" id="id_max_students" min="0" name="max_students" type="number" value="{{course.max_students}}"> | |
| 52 | - | |
| 53 | - <span class="help-block">{% trans 'Max number of students that a class can have' %}</span> | |
| 54 | - | |
| 55 | - </div> | |
| 56 | - | |
| 57 | - <div class="form-group is-fileinput"> | |
| 58 | - <label for="id_init_register_date">{% trans 'Course registration start date' %}</label> | |
| 59 | - | |
| 60 | - | |
| 61 | - <input type="text" class="form-control date-picker" name="init_register_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 62 | - | |
| 63 | - <span class="help-block">{% trans 'Date that starts the registration period of the course (dd/mm/yyyy)' %}</span> | |
| 64 | - | |
| 65 | - </div> | |
| 66 | - | |
| 67 | - <div class="form-group is-fileinput"> | |
| 68 | - <label for="id_end_register_date">{% trans 'Course registration end date' %}</label> | |
| 69 | - | |
| 70 | - | |
| 71 | - <input type="text" class="form-control date-picker" name="end_register_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 72 | - | |
| 73 | - <span class="help-block">{% trans 'Date that ends the registration period of the course (dd/mm/yyyy)' %}</span> | |
| 74 | - | |
| 75 | - </div> | |
| 76 | - | |
| 77 | - <div class="form-group is-fileinput"> | |
| 78 | - <label for="id_init_date">{% trans 'Course start date' %}</label> | |
| 79 | - | |
| 80 | - | |
| 81 | - <input type="text" class="form-control date-picker" name="init_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 82 | - | |
| 83 | - <span class="help-block">{% trans 'Date that the course starts (dd/mm/yyyy)' %}</span> | |
| 84 | - | |
| 85 | - </div> | |
| 86 | - | |
| 87 | - <div class="form-group is-fileinput"> | |
| 88 | - <label for="id_end_date">{% trans 'Course end date' %}</label> | |
| 89 | - | |
| 90 | - | |
| 91 | - <input type="text" class="form-control date-picker" name="end_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 92 | - | |
| 93 | - <span class="help-block">{% trans 'Date that the course ends (dd/mm/yyyy)' %}</span> | |
| 94 | - | |
| 95 | - </div> | |
| 96 | - | |
| 97 | - <div class="form-group is-fileinput"> | |
| 98 | - <label for="id_image">{% trans 'Imagem' %}</label> | |
| 99 | - | |
| 100 | - | |
| 101 | - <input class="form-control" id="id_image" name="image" type="file"> | |
| 102 | - <div class="input-group"> | |
| 103 | - <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | |
| 104 | - <span class="input-group-btn input-group-sm"> | |
| 105 | - <button type="button" class="btn btn-fab btn-fab-mini"> | |
| 106 | - <i class="material-icons">{% trans 'attach_file' %}</i> | |
| 107 | - </button> | |
| 108 | - </span> | |
| 18 | + {% for field in form %} | |
| 19 | + <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> | |
| 20 | + {% if field.auto_id != 'id_public' %} | |
| 21 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 22 | + {% endif %} | |
| 23 | + {% if field.auto_id == 'id_init_register_date' or field.auto_id == 'id_end_register_date' or field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%} | |
| 24 | + <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 25 | + {% elif field.auto_id == 'id_public' %} | |
| 26 | + {% value_field course field.name as value_field %} | |
| 27 | + <div class="checkbox"> | |
| 28 | + <label> | |
| 29 | + <input type="checkbox" name="{{field.name}}" {% if value_field %}checked="checked"{% endif %}><span class="checkbox-material"></span> {{field.name}} | |
| 30 | + </label> | |
| 31 | + </div> | |
| 32 | + {% else %} | |
| 33 | + {% if field.errors %} | |
| 34 | + {% render_field field class='form-control' %} | |
| 35 | + {% else %} | |
| 36 | + {% value_field course field.name as value_field %} | |
| 37 | + {% if field.auto_id == 'id_category' or field.auto_id == 'id_coordenator' %} | |
| 38 | + {% get_value_choice value_field field.field.choices as field_choice%} | |
| 39 | + <select class="form-control" id="{{field.auto_id}}" name="{{field.name}}" required=""> | |
| 40 | + {% for v, name in field.field.choices%} | |
| 41 | + <option value="{{v}}" {% if field_choice == v %}selected{% endif %}>{{name}}</option> | |
| 42 | + {% endfor %} | |
| 43 | + </select> | |
| 44 | + {% elif field.auto_id == 'id_objectivies' or field.auto_id == 'id_content'%} | |
| 45 | + <textarea class="form-control" cols="80" id="{{field.auto_id}}" name="{{field.name}}" rows="5">{{value_field}}</textarea> | |
| 46 | + {% else %} | |
| 47 | + {% render_field field class='form-control' value=value_field%} | |
| 48 | + {% endif %} | |
| 49 | + {% endif %} | |
| 50 | + {% endif %} | |
| 51 | + <span class="help-block">{{ field.help_text }}</span> | |
| 52 | + {% if field.errors %} | |
| 53 | + <div class="row"> | |
| 54 | + </br> | |
| 55 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
| 56 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 57 | + <span aria-hidden="true">×</span> | |
| 58 | + </button> | |
| 59 | + <ul> | |
| 60 | + {% for error in field.errors %} | |
| 61 | + <li>{{ error }}</li> | |
| 62 | + {% endfor %} | |
| 63 | + </ul> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + {% endif %} | |
| 109 | 67 | </div> |
| 110 | - | |
| 111 | - <span class="help-block">{% trans 'Representative image of the course' %}</span> | |
| 112 | - | |
| 113 | - </div> | |
| 114 | - | |
| 115 | - <div class="form-group is-fileinput"> | |
| 116 | - <label for="id_category">{% trans 'CourseCategory' %}</label> | |
| 117 | - | |
| 118 | - | |
| 119 | - <select class="form-control" id="id_category" name="category" required=""> | |
| 120 | - {% for category in categorys_courses %} | |
| 121 | - <option value="{{category.id}}">{{category}}</option> | |
| 122 | - {% endfor %} | |
| 123 | - </select> | |
| 124 | - | |
| 125 | - <span class="help-block">{% trans 'CourseCategory which the course belongs' %}</span> | |
| 126 | - | |
| 127 | - </div> | |
| 128 | - | |
| 68 | + {% endfor %} | |
| 129 | 69 | <div class="row text-center"> |
| 130 | - <input type="submit" value="Create" class="btn btn-primary btn-raised"> | |
| 70 | + <input type="submit" value="{% trans 'Create' %}" class="btn btn-primary btn-raised" /> | |
| 131 | 71 | </div> |
| 132 | - </form> | |
| 72 | + </form> | |
| 133 | 73 | </div> |
| 134 | 74 | </div> |
| 135 | - <script> | |
| 136 | - $(document).ready(function() { | |
| 137 | - $('#id_objectivies').summernote(); | |
| 138 | - $('#id_content').summernote(); | |
| 75 | +</br> | |
| 76 | +</br> | |
| 77 | +</br> | |
| 78 | +<script type="text/javascript"> | |
| 79 | + var locale = navigator.language || navigator.userLanguage; | |
| 80 | + | |
| 81 | + $('.date-picker').datepicker({ | |
| 82 | + language: locale, | |
| 83 | + }); | |
| 84 | + | |
| 85 | + $(document).ready(function() { | |
| 86 | + $('#id_objectivies').summernote({'height':300}); | |
| 87 | + $('#id_content').summernote({'height':300}); | |
| 139 | 88 | }); |
| 140 | - </script> | |
| 141 | -</br></br></br> | |
| 89 | +</script> | |
| 142 | 90 | {% endblock %} | ... | ... |
courses/templates/course/update.html
| ... | ... | @@ -16,9 +16,17 @@ |
| 16 | 16 | {% csrf_token %} |
| 17 | 17 | {% for field in form %} |
| 18 | 18 | <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> |
| 19 | - <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 19 | + {% if field.auto_id != 'id_public' %} | |
| 20 | + <label for="{{ field.auto_id }}">{{ field.label }}</label> | |
| 21 | + {% endif %} | |
| 20 | 22 | {% if field.auto_id == 'id_init_register_date' or field.auto_id == 'id_end_register_date' or field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date'%} |
| 21 | 23 | <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> |
| 24 | + {% elif field.auto_id == 'id_public' %} | |
| 25 | + <div class="checkbox"> | |
| 26 | + <label> | |
| 27 | + <input type="checkbox" name="{{field.name}}" {% if field.value %}checked="checked"{% endif %}><span class="checkbox-material"></span> {{field.name}} | |
| 28 | + </label> | |
| 29 | + </div> | |
| 22 | 30 | {% else %} |
| 23 | 31 | {% render_field field class='form-control' %} |
| 24 | 32 | {% endif %} | ... | ... |
| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | +from django import template | |
| 2 | + | |
| 3 | +register = template.Library() | |
| 4 | + | |
| 5 | +""" | |
| 6 | + Template tag to load all the foruns of a post | |
| 7 | +""" | |
| 8 | + | |
| 9 | +@register.simple_tag | |
| 10 | +def value_field(course, field): | |
| 11 | + value = "" | |
| 12 | + if field == 'name': | |
| 13 | + value = course.name | |
| 14 | + elif field == 'objectivies': | |
| 15 | + value = course.objectivies | |
| 16 | + elif field == 'content': | |
| 17 | + value = course.content | |
| 18 | + elif field == 'max_students': | |
| 19 | + value = course.max_students | |
| 20 | + elif field == 'init_register_date': | |
| 21 | + value = course.init_register_date | |
| 22 | + elif field == 'end_register_date': | |
| 23 | + value = course.end_register_date | |
| 24 | + elif field == 'init_date': | |
| 25 | + value = course.init_date | |
| 26 | + elif field == 'end_date': | |
| 27 | + value = course.end_date | |
| 28 | + elif field == 'coordenator': | |
| 29 | + value = course.coordenator | |
| 30 | + elif field == 'category': | |
| 31 | + value = course.category | |
| 32 | + elif field == 'professors': | |
| 33 | + value = course.professors.all() | |
| 34 | + elif field == 'students': | |
| 35 | + value = course.students.all() | |
| 36 | + elif field == 'public': | |
| 37 | + value = course.public | |
| 38 | + | |
| 39 | + return value | |
| 40 | + | |
| 41 | + | |
| 42 | +@register.simple_tag | |
| 43 | +def get_value_choice(value, choices): | |
| 44 | + for v, name in choices: | |
| 45 | + if (str(name) == str(value)): return v | |
| 46 | + | |
| 47 | + return "" | |
| 48 | + | |
| 49 | +@register.simple_tag | |
| 50 | +def get_tag(field): | |
| 51 | + field.value = "cacsdv" | |
| 52 | + print (dir(field.field)) | |
| 53 | + print (dir(field.field.widget),field.name,"\n\n\n") | ... | ... |
courses/views.py
| ... | ... | @@ -216,6 +216,7 @@ class ReplicateCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati |
| 216 | 216 | context['categorys_courses'] = categorys_courses |
| 217 | 217 | context['title'] = _("Replicate Course") |
| 218 | 218 | context['now'] = date.today() |
| 219 | + print (course.public) | |
| 219 | 220 | return context |
| 220 | 221 | |
| 221 | 222 | def get_success_url(self): |
| ... | ... | @@ -243,6 +244,7 @@ class UpdateCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Updat |
| 243 | 244 | def form_valid(self, form): |
| 244 | 245 | self.object = form.save() |
| 245 | 246 | |
| 247 | + print (form) | |
| 246 | 248 | self.log_context['course_id'] = self.object.id |
| 247 | 249 | self.log_context['course_name'] = self.object.name |
| 248 | 250 | self.log_context['course_slug'] = self.object.slug |
| ... | ... | @@ -256,7 +258,7 @@ class UpdateCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Updat |
| 256 | 258 | def get_context_data(self, **kwargs): |
| 257 | 259 | context = super(UpdateCourseView, self).get_context_data(**kwargs) |
| 258 | 260 | course = get_object_or_404(Course, slug = self.kwargs.get('slug')) |
| 259 | - | |
| 261 | + print (course.public) | |
| 260 | 262 | if has_role(self.request.user,'system_admin'): |
| 261 | 263 | courses = Course.objects.all() |
| 262 | 264 | elif has_role(self.request.user,'professor'): | ... | ... |