Fixed Feed

This commit is contained in:
Anand Doshi 2014-04-04 16:26:45 +05:30
parent a504f0638b
commit bedc62f090
2 changed files with 46 additions and 45 deletions

View File

@ -1,61 +1,61 @@
{
"autoname": "_FEED.#####",
"creation": "2012-07-03 13:29:42.000000",
"docstatus": 0,
"doctype": "DocType",
"autoname": "hash",
"creation": "2012-07-03 13:29:42.000000",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "feed_type",
"fieldtype": "Select",
"label": "Feed Type",
"fieldname": "feed_type",
"fieldtype": "Select",
"label": "Feed Type",
"permlevel": 0
},
},
{
"fieldname": "doc_type",
"fieldtype": "Data",
"label": "Doc Type",
"fieldname": "doc_type",
"fieldtype": "Data",
"label": "Doc Type",
"permlevel": 0
},
},
{
"fieldname": "doc_name",
"fieldtype": "Data",
"label": "Doc Name",
"fieldname": "doc_name",
"fieldtype": "Data",
"label": "Doc Name",
"permlevel": 0
},
},
{
"fieldname": "subject",
"fieldtype": "Data",
"label": "Subject",
"fieldname": "subject",
"fieldtype": "Data",
"label": "Subject",
"permlevel": 0
},
},
{
"fieldname": "color",
"fieldtype": "Data",
"label": "Color",
"fieldname": "color",
"fieldtype": "Data",
"label": "Color",
"permlevel": 0
},
},
{
"fieldname": "full_name",
"fieldtype": "Data",
"label": "Full Name",
"fieldname": "full_name",
"fieldtype": "Data",
"label": "Full Name",
"permlevel": 0
}
],
"icon": "icon-rss",
"idx": 1,
"modified": "2013-12-20 19:24:07.000000",
"modified_by": "Administrator",
"module": "Home",
"name": "Feed",
"owner": "Administrator",
],
"icon": "icon-rss",
"idx": 1,
"modified": "2013-12-20 19:24:05.000000",
"modified_by": "Administrator",
"module": "Home",
"name": "Feed",
"owner": "Administrator",
"permissions": [
{
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager"
}
]
}
}

View File

@ -3,10 +3,11 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
@frappe.whitelist()
def get_feed(arg=None):
"""get feed"""
"""get feed"""
roles = frappe.get_roles()
return frappe.db.sql("""select
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
@ -17,6 +18,6 @@ def get_feed(arg=None):
and t2.permlevel = 0
and ifnull(t2.`read`,0) = 1
order by t1.modified desc
limit %s, %s""" % (','.join(['%s']*len(roles)), '%s', '%s'),
tuple(roles + [frappe.form_dict['limit_start'], frappe.form_dict['limit_page_length']]),
as_dict=1)
limit %s, %s""" % (','.join(['%s']*len(roles)), '%s', '%s'),
tuple(roles + [cint(frappe.form_dict['limit_start']), cint(frappe.form_dict['limit_page_length'])]),
as_dict=1)