Fix bugs:

* Can't create categories and tags
	* Recursively create directories
This commit is contained in:
Gregory Soutade 2014-11-13 19:25:02 +01:00
parent 7aa99e0cbe
commit 62ed52d797
8 changed files with 48 additions and 15 deletions

View File

@ -1,4 +1,4 @@
v0.3 (05/06/2014)
v0.3 (13/11/2014)
** User **
Add draft support
@ -9,9 +9,12 @@ v0.3 (05/06/2014)
** Dev **
Add FileOutputCache : md5 cache in database avoiding disk read operation
Do things in a more python way
** Bugs **
Posts set to non published were not removed during re generation
Can't create categories and tags
Recursively create directories
v0.2 (27/04/2014)

View File

@ -446,7 +446,7 @@ class Index(DynastieGenerator):
return None
if directory and not os.path.exists(output + '/' + directory):
os.mkdir(output + '/' + directory)
os.makedirs(output + '/' + directory)
if not parsePostsTag: return dom

View File

@ -51,9 +51,11 @@
<div class="menu_content_header">Catégories</div>
<div class="menu_content_content">
<ul>
<li><a href="/category/cinema">Cinéma</a></li>
<li><a href="/category/articles">Articles</a></li>
<li><a href="/category/musique">Musique</a></li>
<li><a href="/category/informatique">Informatique</a></li>
<li><a href="/category/cinema">Cinéma</a></li>
<li><a href="/category/sport">Sport</a></li>
<li><a href="/category/configurations-pc">Configurations PC</a></li>
</ul>
</div>
@ -62,11 +64,12 @@
<div class="menu_content_header">Tags</div>
<div class="menu_content_content">
<ul>
<li><a href="/tag/programmation">Programmation</a></li>
<li><a href="/tag/python">Python</a></li>
<li><a href="/tag/kisscount">KissCount</a></li>
<li><a href="/tag/jm2l">JM2L</a></li>
<li><a href="/tag/sheevaplug">SheevaPlug</a></li>
<li><a href="/tag/course-a-pied">Course à pied</a></li>
<li><a href="/tag/tag-rugby">Tag rugby</a></li>
<li><a href="/tag/politique">Politique</a></li>
</ul>
</div>
</div>

View File

@ -52,9 +52,11 @@
<div class="menu_content_header">Catégories</div>
<div class="menu_content_content">
<ul>
<li><a href="/category/cinema">Cinéma</a></li>
<li><a href="/category/articles">Articles</a></li>
<li><a href="/category/musique">Musique</a></li>
<li><a href="/category/informatique">Informatique</a></li>
<li><a href="/category/cinema">Cinéma</a></li>
<li><a href="/category/sport">Sport</a></li>
<li><a href="/category/configurations-pc">Configurations PC</a></li>
</ul>
</div>
@ -63,11 +65,12 @@
<div class="menu_content_header">Tags</div>
<div class="menu_content_content">
<ul>
<li><a href="/tag/programmation">Programmation</a></li>
<li><a href="/tag/python">Python</a></li>
<li><a href="/tag/kisscount">KissCount</a></li>
<li><a href="/tag/jm2l">JM2L</a></li>
<li><a href="/tag/sheevaplug">SheevaPlug</a></li>
<li><a href="/tag/course-a-pied">Course à pied</a></li>
<li><a href="/tag/tag-rugby">Tag rugby</a></li>
<li><a href="/tag/politique">Politique</a></li>
</ul>
</div>
</div>

View File

@ -1,5 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<ljdc>
<entry>
<id>102456707903</id>
<address>http://thecodinglove.com/post/102456707903/switching-frameworks-just-because-a-feature-sounded</address>
<title>switching frameworks just because a feature sounded cool</title>
<img>http://tclhost.com/2mYDrjH.gif</img>
</entry>
<entry>
<id>101328062138</id>
<address>http://thecodinglove.com/post/101328062138/when-a-colleague-hands-me-his-keyboard-to-help-him-fix</address>
<title>When a colleague hands me his keyboard to help him fix a bug</title>
<img>http://tclhost.com/dRUGycW.gif</img>
</entry>
<entry>
<id>100159105239</id>
<address>http://thecodinglove.com/post/100159105239/developer-vs-designer</address>
<title>Developer vs designer</title>
<img>http://tclhost.com/jPOgeEh.gif</img>
</entry>
<entry>
<id>98957550324</id>
<address>http://lesjoiesducode.fr/post/98957550324/quand-je-guette-larrivee-dune-developpeuse-qui-vient</address>
<title>Quand je guette l'arrivée d'une développeuse qui vient passer un entretien</title>
<img>http://ljdchost.com/WS8cDDf.gif</img>
</entry>
<entry>
<id>94165641267</id>
<address>http://thecodinglove.com/post/94165641267/when-the-boss-is-not-around-on-friday-night</address>

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
<form action="/category/add" method="post">{% csrf_token %}
<form action="/category/add/{{ blog.id }}" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="add" value="Add" />
<input type="submit" name="cancel" value="Cancel" />

View File

@ -11,5 +11,5 @@
{% endfor %}
</table>
{% endif %}
<li><a href="/category/add">Add a category</a></li>
<li><a href="/category/add/{{ blog.id }}">Add a category</a></li>
{% endblock %}

View File

@ -207,7 +207,7 @@ def add_category(request, blog_id):
if request.method == 'POST':
if 'add' in request.POST:
form = CategoryForm(request.POST)
form.blog = b
form.instance.blog = b
if form.is_valid():
form = form.save()
return HttpResponseRedirect('/category/' + str(b.id))
@ -216,7 +216,7 @@ def add_category(request, blog_id):
else:
form = CategoryForm()
return render(request, 'add_category.html', {'form': form})
return render(request, 'add_category.html', {'form': form, 'blog' : b})
@login_required
def edit_category(request, category_id):
@ -356,7 +356,7 @@ def view_blog(request, blog_id):
else:
drafts = []
count = orig_posts.count() - drafts.count()
count = len(orig_posts) - len(drafts)
nb_pages = int(count/50)
# Prevent error injection
@ -366,7 +366,7 @@ def view_blog(request, blog_id):
request.session['cur_page'] = cur_page
start = cur_page * 50
end = start + 50 + drafts.count()
end = start + 50 + len(drafts)
orig_posts = orig_posts.order_by('-creation_date')[start:end]
@ -628,7 +628,7 @@ def _generate(request, blog_id, report):
b,_ = have_I_right(request, blog_id)
posts = Post.objects.filter(blog=b).order_by('-creation_date')
nb_pages = int(posts.count()/50)
nb_pages = int(len(posts)/50)
posts = posts[0:50]
b = Blog.objects.get(pk=blog_id)
form = BlogForm(instance=b)