summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorajay javiya (OpenERP) <aja@tinyerp.com>2014-03-28 16:50:08 +0530
committerajay javiya (OpenERP) <aja@tinyerp.com>2014-03-28 16:50:08 +0530
commit4931eae3c19b4cac9c83bd8cbe2da6bb39d707c7 (patch)
treec5db65e3a52b9bd81204b393a8c611366579184c
parente52dd4eeb8dbadd59e662684363bbc76f3ad8c75 (diff)
[REM] : archive related changes
-> remove routes related to date on blog method bzr revid: aja@tinyerp.com-20140328112008-8mhxvqxs8g1ui2mn
-rw-r--r--addons/website_blog/controllers/main.py17
-rw-r--r--addons/website_blog/views/website_blog_templates.xml4
2 files changed, 8 insertions, 13 deletions
diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py
index bf77c632e0a..03c647700bd 100644
--- a/addons/website_blog/controllers/main.py
+++ b/addons/website_blog/controllers/main.py
@@ -38,8 +38,7 @@ class WebsiteBlog(http.Controller):
groups = blog_post_obj.read_group(request.cr, request.uid, [], ['name', 'create_date'],
groupby="create_date", orderby="create_date asc", context=request.context)
for group in groups:
- group['date_begin'] = str(datetime.date(datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATETIME_FORMAT)))
- group['date_end'] = str(datetime.date(datetime.strptime( group['__domain'][1][2], tools.DEFAULT_SERVER_DATETIME_FORMAT)))
+ group['date'] = "%s_%s" % (group['__domain'][0][2], group['__domain'][1][2])
return groups
@http.route([
@@ -68,12 +67,8 @@ class WebsiteBlog(http.Controller):
'/blog/<model("blog.blog"):blog>/page/<int:page>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>',
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/page/<int:page>',
- '/blog/<model("blog.blog"):blog>/date/<string(length=10):date_begin>/<string(length=10):date_end>',
- '/blog/<model("blog.blog"):blog>/date/<string(length=10):date_begin>/<string(length=10):date_end>/page/<int:page>',
- '/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=10):date_begin>/<string(length=10):date_end>',
- '/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=10):date_begin>/<string(length=10):date_end>/page/<int:page>',
], type='http', auth="public", website=True, multilang=True)
- def blog(self, blog=None, tag=None, date_begin=None,date_end=None, page=1, **opt):
+ def blog(self, blog=None, tag=None, date=None, page=1, **opt):
""" Prepare all values to display the blog.
:param blog: blog currently browsed.
@@ -107,9 +102,9 @@ class WebsiteBlog(http.Controller):
if tag:
path_filter += 'tag/%s' % tag.id
domain += [("tag_ids", "in", [tag.id])]
- if date_begin and date_end:
- path_filter += "date/%s/%s" % (date_begin,date_end)
- domain += [("create_date", ">=", date_begin), ("create_date", "<=", date_end)]
+ if date:
+ path_filter += "date/%s" % date
+ domain += [("create_date", ">=", date.split("_")[0]), ("create_date", "<=", date.split("_")[1])]
blog_post_count = blog_post_obj.search(cr, uid, domain, count=True, context=context)
pager = request.website.pager(
@@ -135,7 +130,7 @@ class WebsiteBlog(http.Controller):
'pager': pager,
'nav_list': self.nav_list(),
'path_filter': path_filter,
- 'date': date_begin,
+ 'date': date,
}
response = request.website.render("website_blog.blog_post_short", values)
return response
diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml
index 85718196e13..3ff854f764f 100644
--- a/addons/website_blog/views/website_blog_templates.xml
+++ b/addons/website_blog/views/website_blog_templates.xml
@@ -345,8 +345,8 @@
<h4>Archives</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="nav_list" t-as="months">
- <li t-att-class="months['date_begin'] == date and 'active' or None">
- <a t-ignore="True" t-attf-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date_begin'] }/#{ months['date_end'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
+ <li t-att-class="months['date'] == date and 'active' or None">
+ <a t-ignore="True" t-attf-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
</li>
</t>
</ul>