diff --git a/frappe/model/meta.py b/frappe/model/meta.py index 0c5ec75597..1cc3abba5b 100644 --- a/frappe/model/meta.py +++ b/frappe/model/meta.py @@ -483,6 +483,9 @@ class Meta(Document): def get_row_template(self): return self.get_web_template(suffix='_row') + def get_list_template(self): + return self.get_web_template(suffix='_list') + def get_web_template(self, suffix=''): '''Returns the relative path of the row template for this doctype''' module_name = frappe.scrub(self.module) diff --git a/frappe/templates/includes/blog/blog_list.html b/frappe/templates/includes/blog/blog_list.html deleted file mode 100644 index cfe25f3682..0000000000 --- a/frappe/templates/includes/blog/blog_list.html +++ /dev/null @@ -1,25 +0,0 @@ -{% if sub_title %} -

{{ sub_title }}

-{% endif %} -{% if not result -%} -
- {{ no_result_message or _("Nothing to show") }} -
-{% else %} -
- - {% if result_heading_template %}{% include result_heading_template %}{% endif %} - -
- {% for item in result %} - {{ item }} - {% endfor %} -
- -
-{%- endif %} diff --git a/frappe/website/doctype/blog_post/blog_post.py b/frappe/website/doctype/blog_post/blog_post.py index a696ebc8c2..8a0e2323fc 100644 --- a/frappe/website/doctype/blog_post/blog_post.py +++ b/frappe/website/doctype/blog_post/blog_post.py @@ -153,7 +153,6 @@ class BlogPost(WebsiteGenerator): def get_list_context(context=None): list_context = frappe._dict( - template = "/templates/includes/blog/blog.html", get_list = get_blog_list, no_breadcrumbs = True, hide_filters = True, diff --git a/frappe/templates/includes/blog/blog.html b/frappe/website/doctype/blog_post/templates/blog_post_list.html similarity index 100% rename from frappe/templates/includes/blog/blog.html rename to frappe/website/doctype/blog_post/templates/blog_post_list.html diff --git a/frappe/www/list.py b/frappe/www/list.py index 313505b729..03171a74bd 100644 --- a/frappe/www/list.py +++ b/frappe/www/list.py @@ -171,6 +171,9 @@ def get_list_context(context, doctype, web_form_name=None): if not meta.custom and not list_context.row_template: list_context.row_template = meta.get_row_template() + if not meta.custom and not list_context.list_template: + list_context.template = meta.get_list_template() + return list_context def get_list(doctype, txt, filters, limit_start, limit_page_length=20, ignore_permissions=False,