diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index dbfd973..70b5e62 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -59,12 +59,12 @@ } #create-category{ - margin-left: 40%; + margin-left: 20%; margin-bottom: 1%; border: none; background-color: #66BB6A; color: #FFFFFF; - width: 200px; + width: 60%; height: 40px; font-size: 15px; } diff --git a/categories/forms.py b/categories/forms.py index fc28e2f..910fc38 100644 --- a/categories/forms.py +++ b/categories/forms.py @@ -9,4 +9,4 @@ class CategoryForm(forms.ModelForm): 'description': forms.Textarea, 'coordinators' : forms.SelectMultiple, } - \ No newline at end of file + \ No newline at end of file diff --git a/categories/templates/categories/create.html b/categories/templates/categories/create.html index 81a661e..8b1861a 100644 --- a/categories/templates/categories/create.html +++ b/categories/templates/categories/create.html @@ -1,6 +1,6 @@ {% extends 'categories/home.html' %} -{% load widget_tweaks static i18n permission_tags django_bootstrap_breadcrumbs %} +{% load widget_tweaks static i18n permission_tags django_bootstrap_breadcrumbs switchevenodd %} {% block breadcrumbs %} {{ block.super }} @@ -28,6 +28,24 @@ {% elif field.auto_id == 'id_description' %} {% render_field field class='form-control text_wysiwyg' %} + + + {% comment %} + + {% endcomment %} + {% elif field.auto_id == 'id_coordinators' %} + + {% else %} {% render_field field class='form-control' %} {% endif %} diff --git a/categories/templates/categories/list.html b/categories/templates/categories/list.html index 15fff77..397a14a 100755 --- a/categories/templates/categories/list.html +++ b/categories/templates/categories/list.html @@ -84,11 +84,12 @@ {{coordinator.username}} {% endfor %} - {{category.description|safe}} + + + {{category.description|safe}} {% if user in category.coordinators.all %} {% endif %} - {% comment %} diff --git a/categories/templates/categories/update.html b/categories/templates/categories/update.html index 7592a84..db12bd2 100644 --- a/categories/templates/categories/update.html +++ b/categories/templates/categories/update.html @@ -66,8 +66,8 @@ }); $('#id_coordinators').multiSelect({ - selectableHeader: "", - selectionHeader: "", + selectableHeader: "", + selectionHeader: "", afterInit: function(ms){ var that = this, $selectableSearch = that.$selectableUl.prev(), diff --git a/categories/templatetags/__init__.py b/categories/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/categories/templatetags/__init__.py diff --git a/categories/templatetags/switchevenodd.py b/categories/templatetags/switchevenodd.py new file mode 100644 index 0000000..72760c2 --- /dev/null +++ b/categories/templatetags/switchevenodd.py @@ -0,0 +1,16 @@ +from django import template + +register = template.Library() + +class switchevenodd(template.Node): + """docstring for switchevenodd""" + def __init__(self, *args): + if args: + print(args) + + def render(self, context): + + context['switch'] = not context['switch'] + return '' + +register.tag('switchevenodd', switchevenodd) \ No newline at end of file diff --git a/categories/views.py b/categories/views.py index c04c966..a88cb0e 100644 --- a/categories/views.py +++ b/categories/views.py @@ -18,6 +18,8 @@ from subjects.models import Subject from log.mixins import LogMixin +from users.models import User + class IndexView(LoginRequiredMixin, ListView): login_url = reverse_lazy("users:login") @@ -72,6 +74,7 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat success_url = reverse_lazy('categories:index') + def get_initial(self): initial = super(CreateCategory, self).get_initial() @@ -82,16 +85,21 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat initial['description'] = category.description initial['name'] = category.name initial['visible'] = category.visible - #initial['coordinators'] = category.coordinators + self.log_action = 'replicate' self.log_context['replicated_category_id'] = category.id self.log_context['replicated_category_name'] = category.name self.log_context['replicated_category_slug'] = category.slug - return initial + def get_context_data(self, **kwargs): + context = super(CreateCategory, self).get_context_data(**kwargs) + context['users_count'] = User.objects.all().count() + context['switch'] = True + return context + def get_form(self, form_class=None): """ -- libgit2 0.21.2