Catégories affichées dans la navbar.
This commit is contained in:
parent
9c82cb8ee7
commit
21c1a5719b
4 changed files with 30 additions and 1 deletions
23
content/migrations/0002_auto_20180124_1043.py
Normal file
23
content/migrations/0002_auto_20180124_1043.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 2.0.1 on 2018-01-24 10:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('content', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='category',
|
||||
name='Nom de la catégorie',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='category',
|
||||
name='name',
|
||||
field=models.CharField(default='Nom de la catégorie', max_length=255, verbose_name='Nom de la catégorie'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -6,7 +6,7 @@ class Category(models.Model):
|
|||
"""Une catégorie de contenu."""
|
||||
name = models.CharField(
|
||||
max_length=255,
|
||||
name="Nom de la catégorie"
|
||||
verbose_name="Nom de la catégorie"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.urls import path
|
|||
|
||||
from .views import ContentCategoryList
|
||||
|
||||
app_name = 'content'
|
||||
urlpatterns = [
|
||||
path(
|
||||
'category/<int:category_id>/',
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% load categories %}
|
||||
{% load_categories %}
|
||||
<nav class="navbar navbar-default navbar-inverse">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
|
@ -15,6 +17,9 @@
|
|||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
|
||||
{% for category in categories %}
|
||||
<li><a href="{% url 'content:category-list' category_id=category.id %}">{{category.name}}</a></li>
|
||||
{% endfor %}
|
||||
<li><a href="">Vote</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
|
||||
|
|
Loading…
Reference in a new issue