Commit 298ca50ac637b9fd95a475d9cdc56a095d8970b2
1 parent
a4a5a12d
Exists in
master
and in
3 other branches
modified categories model to support null parent categories and changed index l…
…ayout a bit for usefulness
Showing
7 changed files
with
32 additions
and
7 deletions
Show diff stats
amadeus/static/css/base/amadeus.css
@@ -2,13 +2,13 @@ | @@ -2,13 +2,13 @@ | ||
2 | /* sidebar menu */ | 2 | /* sidebar menu */ |
3 | 3 | ||
4 | #sidebar-menu{ | 4 | #sidebar-menu{ |
5 | - margin-left: 10%; | 5 | + margin-left: 30%; |
6 | } | 6 | } |
7 | #sidebar-menu > .item{ | 7 | #sidebar-menu > .item{ |
8 | font-size: 45px; | 8 | font-size: 45px; |
9 | background-color: #26A69A; | 9 | background-color: #26A69A; |
10 | color: white; | 10 | color: white; |
11 | - width: 50%; | 11 | + width: 80%; |
12 | margin-bottom: 3%; | 12 | margin-bottom: 3%; |
13 | } | 13 | } |
14 | 14 | ||
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | 20 | ||
21 | 21 | ||
22 | #sidebar-menu > .item i { | 22 | #sidebar-menu > .item i { |
23 | - margin-left: 10%; | 23 | + margin-left: 15%; |
24 | } | 24 | } |
25 | /* side bar menu ends*/ | 25 | /* side bar menu ends*/ |
26 | 26 |
amadeus/static/nothing.txt
amadeus/templates/base.html
@@ -70,7 +70,7 @@ | @@ -70,7 +70,7 @@ | ||
70 | <span class="icon-bar"></span> | 70 | <span class="icon-bar"></span> |
71 | <span class="icon-bar"></span> | 71 | <span class="icon-bar"></span> |
72 | </button> | 72 | </button> |
73 | - <a class="navbar-brand" href="#"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a> | 73 | + <a class="navbar-brand" href="{% url 'categories:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a> |
74 | </div> | 74 | </div> |
75 | <div class="navbar-collapse collapse navbar-responsive-collapse"> | 75 | <div class="navbar-collapse collapse navbar-responsive-collapse"> |
76 | <div class="col-md-5 cards-content" id= 'NavBarSearch'> | 76 | <div class="col-md-5 cards-content" id= 'NavBarSearch'> |
categories/forms.py
@@ -5,3 +5,7 @@ class CategoryForm(forms.ModelForm): | @@ -5,3 +5,7 @@ class CategoryForm(forms.ModelForm): | ||
5 | class Meta: | 5 | class Meta: |
6 | model = Category | 6 | model = Category |
7 | fields = ('category_father', 'name', 'description', 'visible', 'coordinators', ) | 7 | fields = ('category_father', 'name', 'description', 'visible', 'coordinators', ) |
8 | + widgets = { | ||
9 | + 'category_father': forms.Select(), | ||
10 | + | ||
11 | + } | ||
8 | \ No newline at end of file | 12 | \ No newline at end of file |
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-12-23 18:04 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | +import django.db.models.deletion | ||
7 | + | ||
8 | + | ||
9 | +class Migration(migrations.Migration): | ||
10 | + | ||
11 | + dependencies = [ | ||
12 | + ('categories', '0001_initial'), | ||
13 | + ] | ||
14 | + | ||
15 | + operations = [ | ||
16 | + migrations.AlterField( | ||
17 | + model_name='category', | ||
18 | + name='category_father', | ||
19 | + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='category_parent', to='categories.Category'), | ||
20 | + ), | ||
21 | + ] |
categories/models.py
@@ -6,7 +6,7 @@ from users.models import User | @@ -6,7 +6,7 @@ from users.models import User | ||
6 | class Category(models.Model): | 6 | class Category(models.Model): |
7 | """Represents a Course """ | 7 | """Represents a Course """ |
8 | 8 | ||
9 | - category_father = models.ForeignKey('Category', related_name =_("category_parent"), on_delete = models.CASCADE) | 9 | + category_father = models.ForeignKey('Category', related_name =_("category_parent"), on_delete = models.CASCADE, null = True, blank = True) |
10 | name = models.CharField(_("Name"), max_length = 100, blank=False, null=False) | 10 | name = models.CharField(_("Name"), max_length = 100, blank=False, null=False) |
11 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) | 11 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
12 | description = models.CharField(_("description"), max_length = 300) | 12 | description = models.CharField(_("description"), max_length = 300) |
categories/views.py
@@ -67,9 +67,9 @@ class CreateCategory(HasRoleMixin, CreateView): | @@ -67,9 +67,9 @@ class CreateCategory(HasRoleMixin, CreateView): | ||
67 | login_url = reverse_lazy('users:login') | 67 | login_url = reverse_lazy('users:login') |
68 | form_class = CategoryForm | 68 | form_class = CategoryForm |
69 | template_name = 'categories/create.html' | 69 | template_name = 'categories/create.html' |
70 | - success_url = reverse_lazy('courses:index') | 70 | + success_url = reverse_lazy('categories:index') |
71 | 71 | ||
72 | def form_valid(self, form): | 72 | def form_valid(self, form): |
73 | self.object = form.save() | 73 | self.object = form.save() |
74 | #TODO: Implement log calls | 74 | #TODO: Implement log calls |
75 | - return super(createCategory, self).form_valid(form) | 75 | + return super(CreateCategory, self).form_valid(form) |