diff --git a/forms.py b/forms.py
index ba62ab2..7cc8f75 100644
--- a/forms.py
+++ b/forms.py
@@ -8,7 +8,7 @@ class BlogForm(ModelForm):
class PostForm(ModelForm):
class Meta:
model = Post
- exclude = ('title_slug', 'creation_date', 'author', 'blog', 'tags')
+ exclude = ('title_slug', 'creation_date', 'modification_date', 'author', 'blog', 'tags')
def __init__(self, *args, **kwargs):
super(PostForm, self).__init__(*args, **kwargs)
diff --git a/generators/atom.py b/generators/atom.py
index 313f9c2..c569798 100644
--- a/generators/atom.py
+++ b/generators/atom.py
@@ -31,7 +31,7 @@ class Atom(RSS):
self.appendElement(dom, root, 'generator', 'The Dynastie project', {'uri':'http://indefero.soutade.fr/p/dynastie', 'version':'0.1'})
self.appendElement(dom, root, 'link', '', {'rel':'self', 'type':'application/atom+xml', 'href':address + '/atom.xml'})
- posts = Post.objects.filter(published=True).order_by('-creation_date')[:10]
+ posts = Post.objects.filter(published=True).order_by('-modification_date')[:10]
for post in posts:
item = dom.createElement('entry')
@@ -41,7 +41,8 @@ class Atom(RSS):
creationDate = post.creation_date.strftime('%Y-%m-%dT%H:%M:%SZ')
self.appendElement(dom, item, 'published', creationDate)
- self.appendElement(dom, item, 'updated', creationDate)
+ modificationDate = post.modification_date.strftime('%Y-%m-%dT%H:%M:%SZ')
+ self.appendElement(dom, item, 'updated', modificationDate)
self.appendElement(dom, item, 'id', path)
author = dom.createElement('author')
self.appendElement(dom, author, 'name', post.author.first_name + ' ' + post.author.last_name)
diff --git a/generators/rss.py b/generators/rss.py
index 9576283..3f50ea8 100644
--- a/generators/rss.py
+++ b/generators/rss.py
@@ -40,7 +40,7 @@ class RSS(DynastieGenerator):
self.appendElement(dom, channel, 'generator', 'Dynastie')
self.appendElement(dom, channel, 'language', 'en-gb')
- posts = Post.objects.filter(published=True).order_by('-creation_date')[:10]
+ posts = Post.objects.filter(published=True).order_by('-modification_date')[:10]
for post in posts:
item = dom.createElement('item')
diff --git a/models.py b/models.py
index 241380c..3575f66 100644
--- a/models.py
+++ b/models.py
@@ -188,6 +188,7 @@ class Post(models.Model):
category = models.ForeignKey(Category, blank=True, null=True, on_delete=models.SET_NULL)
published = models.BooleanField()
creation_date = models.DateTimeField()
+ modification_date = models.DateTimeField()
front_page = models.BooleanField()
author = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
description = models.TextField(max_length=255, blank=True)
diff --git a/templates/generate.html b/templates/generate.html
index ed6d008..0927dd2 100644
--- a/templates/generate.html
+++ b/templates/generate.html
@@ -9,7 +9,7 @@
{% endif %}
-Add an post Generate blog
+Add a post Generate blog
{% if report|length == 0 %}
Any engine selected
{% else %}
diff --git a/templates/view_blog.html b/templates/view_blog.html
index 5be985f..b006f24 100644
--- a/templates/view_blog.html
+++ b/templates/view_blog.html
@@ -9,7 +9,7 @@
{% endif %}
-Add an post Generate blog
+Add a post Generate blog
{% if posts|length == 0 %}
@@ -17,7 +17,7 @@
{% else %}
{{ post.id }} | {{ post.title }} | {{ post.category.name }} | {{ post.creation_date }} | {{ post.published }} | {{ post.front_page }} | Delete | |
{{ post.id }} | {{ post.title }} | {{ post.category.name }} | {{ post.creation_date }} | {{ post.modification_date }} | {{ post.published }} | {{ post.front_page }} | Delete |