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 | 2 | /* sidebar menu */ |
3 | 3 | |
4 | 4 | #sidebar-menu{ |
5 | - margin-left: 10%; | |
5 | + margin-left: 30%; | |
6 | 6 | } |
7 | 7 | #sidebar-menu > .item{ |
8 | 8 | font-size: 45px; |
9 | 9 | background-color: #26A69A; |
10 | 10 | color: white; |
11 | - width: 50%; | |
11 | + width: 80%; | |
12 | 12 | margin-bottom: 3%; |
13 | 13 | } |
14 | 14 | |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | |
21 | 21 | |
22 | 22 | #sidebar-menu > .item i { |
23 | - margin-left: 10%; | |
23 | + margin-left: 15%; | |
24 | 24 | } |
25 | 25 | /* side bar menu ends*/ |
26 | 26 | ... | ... |
amadeus/static/nothing.txt
amadeus/templates/base.html
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 | <span class="icon-bar"></span> |
71 | 71 | <span class="icon-bar"></span> |
72 | 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 | 74 | </div> |
75 | 75 | <div class="navbar-collapse collapse navbar-responsive-collapse"> |
76 | 76 | <div class="col-md-5 cards-content" id= 'NavBarSearch'> | ... | ... |
categories/forms.py
... | ... | @@ -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 | 6 | class Category(models.Model): |
7 | 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 | 10 | name = models.CharField(_("Name"), max_length = 100, blank=False, null=False) |
11 | 11 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
12 | 12 | description = models.CharField(_("description"), max_length = 300) | ... | ... |
categories/views.py
... | ... | @@ -67,9 +67,9 @@ class CreateCategory(HasRoleMixin, CreateView): |
67 | 67 | login_url = reverse_lazy('users:login') |
68 | 68 | form_class = CategoryForm |
69 | 69 | template_name = 'categories/create.html' |
70 | - success_url = reverse_lazy('courses:index') | |
70 | + success_url = reverse_lazy('categories:index') | |
71 | 71 | |
72 | 72 | def form_valid(self, form): |
73 | 73 | self.object = form.save() |
74 | 74 | #TODO: Implement log calls |
75 | - return super(createCategory, self).form_valid(form) | |
75 | + return super(CreateCategory, self).form_valid(form) | ... | ... |