Redirect user to comment when it's added and not to begining of page

Always update	modification date when post/draft is saved
Update version
This commit is contained in:
Gregory Soutade 2015-08-09 15:33:19 +02:00
parent 0b871656b5
commit 47f5f97618
4 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,10 @@
v0.4 (09/08/2015)
** User **
Redirect user to comment when it's added and not to begining of page
** Bugs **
Always update modification date when post/draft is saved
v0.3 (13/11/2014) v0.3 (13/11/2014)
** User ** ** User **

View File

@ -255,6 +255,7 @@ class Post(models.Model):
def save(self): def save(self):
self.title = self.title.strip() self.title = self.title.strip()
self.title_slug = slugify(self.title) self.title_slug = slugify(self.title)
self.modification_date=datetime.now()
super(Post, self).save() super(Post, self).save()
def manageTags(self, tags): def manageTags(self, tags):
@ -320,7 +321,6 @@ class Post(models.Model):
f = open(filename, 'wb') f = open(filename, 'wb')
f.write(content) f.write(content)
f.close() f.close()
self.modification_date=datetime.now()
self.manageTags(tags) self.manageTags(tags)
@ -386,7 +386,6 @@ class Draft(Post):
f = open(filename, 'wb') f = open(filename, 'wb')
f.write(content) f.write(content)
f.close() f.close()
self.modification_date=datetime.now()
self.manageTags(tags) self.manageTags(tags)
self.save() self.save()

View File

@ -10,6 +10,6 @@
<a href="/user">Users</a> <a href="/blog">Blogs</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 %} {% block content %} {% endblock %}
<br/><br/><br/> <br/><br/><br/>
<center><a href="http://indefero.soutade.fr/p/dynastie">Dynastie</a> 0.3</center> <center><a href="http://indefero.soutade.fr/p/dynastie">Dynastie</a> 0.4</center>
</body> </body>
</html> </html>

View File

@ -893,6 +893,7 @@ def add_comment(request, post_id, parent_id):
connection.send_messages(messages) connection.send_messages(messages)
connection.close() connection.close()
ref = ref + '#comment_%s' % (comment_index)
response = HttpResponseRedirect(ref) response = HttpResponseRedirect(ref)
response['Cache-Control'] = 'no-store, no-cache, must-revalidate' response['Cache-Control'] = 'no-store, no-cache, must-revalidate'
response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT' response['Expires'] = 'Thu, 01 Jan 1970 00:00:00 GMT'