Set category and tag refers to a Blog

This commit is contained in:
2012-10-09 20:47:12 +02:00
parent d30bb18e43
commit 76cda68611
10 changed files with 64 additions and 41 deletions

View File

@@ -4,7 +4,7 @@
{% block head %} {% endblock %}
</head>
<body>
<a href="/user">Users</a> <a href="/blog">Blogs</a> <a href="/category">Categories</a> <a href="/disconnect">Disconnect</a><br/><br/>
<a href="/user">Users</a> <a href="/blog">Blogs</a> <a href="/disconnect">Disconnect</a><br/><br/>
{% block content %} {% endblock %}
</body>
</html>

View File

@@ -7,12 +7,10 @@
{% else %}
<table>
{% for category in categories %}
<tr><td>{{ category.id }}</td><td>{{ category.name }}</td><td><a href="/category/edit/{{ category.id }}">Edit</a></td>{% if user.is_superuser %}<td><a href="/category/delete/{{ category.id }}">Delete</a></td>{% endif %}</tr>
<tr><td>{{ category.id }}</td><td>{{ category.name }}</td><td><a href="/category/edit/{{ category.id }}">Edit</a></td><td><a href="/category/delete/{{ category.id }}">Delete</a></td></tr>
{% endfor %}
</table>
{% endif %}
{% if user.is_superuser %}
<li><a href="/category/add">Add a category</a></li>
{% endif %}
<li><a href="/category/add">Add a category</a></li>
</table>
{% endblock %}

View File

@@ -4,10 +4,6 @@
<form action="/category/edit/{{ category.id }}" method="post">
{% csrf_token %}
{{ form.as_p }}
{% if user.is_superuser %}
<input type="submit" name="edit" value="Edit" />
{% else %}
<input type="submit" name="cancel" value="Cancel" />
{% endif %}
<input type="submit" name="edit" value="Edit" /> <input type="submit" name="cancel" value="Cancel" />
</form>
{% endblock %}

View File

@@ -1,6 +1,7 @@
{% extends "templates/base.html" %}
{% block content %}
<a href="/category/{{ blog.id }}">Categories</a>
{% if user.is_superuser %}
<form action="/blog/edit/{{ blog.id }}" method="post">
{% csrf_token %}
@@ -24,7 +25,9 @@
{% else %}
<table>
{% for post in posts %}
{% with post.id as cur_id %}
<tr><td><a href="/post/edit/{{ post.id }}">{{ post.id }}</a></td><td>{{ post.title }}</td><td>{{ post.category.name }}</td><td>{{ post.creation_date }}</td><td>{{ post.modification_date }}</td><td>{{ post.published }}</td><td>{{ post.front_page }}</td><td>{{ comments|hash:cur_id|default_if_none:"0" }} comment{{ comments|hash:cur_id|pluralize }}</td><td><a href="/post/delete/{{ post.id }}">Delete</a></td></tr>
{% endwith %}
{% endfor %}
{% endif %}
</table>

View File

@@ -1,6 +1,7 @@
{% extends "templates/base.html" %}
{% block content %}
<a href="/category/{{ blog.id }}">Categories</a>
{% if user.is_superuser %}
<form action="/blog/edit/{{ blog.id }}" method="post">
{% csrf_token %}