diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-04-16 08:58:11 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-04-16 11:37:57 +0200 |
commit | a3c2bd47e6d9a64539000d4921ee58eed1ea3968 (patch) | |
tree | 479560e61f85ba2546ddb85f9a319a7625f85f9d /pyaggr3g470r/views | |
parent | redoing full text search (diff) | |
download | newspipe-a3c2bd47e6d9a64539000d4921ee58eed1ea3968.tar.gz newspipe-a3c2bd47e6d9a64539000d4921ee58eed1ea3968.tar.bz2 newspipe-a3c2bd47e6d9a64539000d4921ee58eed1ea3968.zip |
introducing the or filter component
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r-- | pyaggr3g470r/views/views.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index 83012d7c..c681a94d 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -255,9 +255,8 @@ def render_home(filters={}, head_title='', page_to_render='home', **kwargs): filters['readed'] = filter_ == 'read' if feed_id: filters['feed_id'] = feed_id - if head_title: - head_title += ' - ' - head_title += feed_contr.get(id=feed_id).title + head_title = "%s%s" % (feed_contr.get(id=feed_id).title, + (' - %s' % head_title) if head_title else '') articles = arti_contr.read(**filters).order_by(Article.date.desc()) if limit != 'all': @@ -275,7 +274,7 @@ def render_home(filters={}, head_title='', page_to_render='home', **kwargs): articles = list(articles) if (page_to_render == 'home' and feed_id or page_to_render == 'search') \ - and not articles: + and filter_ != 'all' and not articles: return redirect(gen_url(filter_='all')) if sort_ == "feed": @@ -315,6 +314,8 @@ def search(): filters['title__like'] = "%%%s%%" % query if search_content == 'on': filters['content__like'] = "%%%s%%" % query + if len(filters) > 1: + filters = {"__or__": filters} return render_home(filters, "%s %s" % (gettext('Search:'), query), 'search', search_query=query, search_title=search_title, search_content=search_content) |