Fix add_post encoding bug + some minor bugs
This commit is contained in:
parent
e99280e21c
commit
c60cd7e3f8
|
@ -225,7 +225,8 @@ class Post(models.Model):
|
|||
if os.path.exists(filename):
|
||||
os.unlink(filename)
|
||||
f = open(filename, 'wb')
|
||||
f.write(content)
|
||||
content = unicode(content)
|
||||
f.write(content.encode('utf-8'))
|
||||
f.close()
|
||||
|
||||
def remove(self):
|
||||
|
@ -244,14 +245,14 @@ class Post(models.Model):
|
|||
if os.path.exists(filename):
|
||||
os.unlink(filename)
|
||||
|
||||
filename = b.output_path + '/post/'
|
||||
filename = b.src_path + '/post/'
|
||||
filename = filename + self.creation_date.strftime("%Y") + '/' + self.creation_date.strftime("%m") + '/'
|
||||
if len(os.listdir(filename)) == 0:
|
||||
if os.path.exists(filename) and len(os.listdir(filename)) == 0:
|
||||
os.rmdir(filename)
|
||||
|
||||
filename = b.output_path + '/post/'
|
||||
filename = filename + self.creation_date.strftime("%Y") + '/'
|
||||
if len(os.listdir(filename)) == 0:
|
||||
if os.path.exists(filename) and len(os.listdir(filename)) == 0:
|
||||
os.rmdir(filename)
|
||||
|
||||
class Comment(models.Model):
|
||||
|
|
|
@ -9,7 +9,9 @@ tinyMCE.init({
|
|||
theme : "advanced",
|
||||
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
|
||||
editor_selector : "mceAdvanced",
|
||||
|
||||
encoding : "raw",
|
||||
entities : "",
|
||||
entity_encoding : "raw",
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
|
||||
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{% else %}
|
||||
<table>
|
||||
{% for post in posts %}
|
||||
<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.published }}</td><td>{{ post.front_page }}</td><td><a href="/post/delete/{{ post.id }}">Delete</a></td></tr>
|
||||
<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><a href="/post/delete/{{ post.id }}">Delete</a></td></tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue
Block a user