[blog] [minor] ability to disable blogger

This commit is contained in:
Rushabh Mehta 2013-08-30 16:38:36 +05:30
parent 05a301faf4
commit e18133c726
4 changed files with 23 additions and 17 deletions

View File

@ -130,7 +130,7 @@
},
"writers": {
"template": "app/website/templates/pages/writers",
"args_method": "website.helpers.blog.get_writers_args"
"args_method": "website.doctype.blogger.blogger.get_writers_args"
},
"profile": {
"no_cache": true,

View File

@ -23,3 +23,18 @@ class DocType:
b.doc.blogger = self.doc.name
b.save()
def get_writers_args():
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
where ifnull(posts,0) > 0 and ifnull(disabled,0)=0
order by posts desc""", as_dict=1)
args = {
"bloggers": bloggers,
"texts": {
"all_posts_by": _("All posts by")
},
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
}
args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
return args

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-25 16:00:51",
"docstatus": 0,
"modified": "2013-07-05 14:27:34",
"modified": "2013-08-30 16:35:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -39,6 +39,12 @@
"doctype": "DocType",
"name": "Blogger"
},
{
"doctype": "DocField",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
},
{
"description": "Will be used in url (usually first name).",
"doctype": "DocField",

View File

@ -119,18 +119,3 @@ def get_blog_template_args():
}
args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
return args
def get_writers_args():
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
order by posts desc""", as_dict=1)
args = {
"bloggers": bloggers,
"texts": {
"all_posts_by": _("All posts by")
},
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
}
args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
return args