added get_creation_count and other fixes
This commit is contained in:
parent
e332a26191
commit
bb65bf27fd
6 changed files with 18 additions and 6 deletions
|
|
@ -145,6 +145,7 @@ class InvalidStatusError(ValidationError): pass
|
|||
class DoesNotExistError(ValidationError): pass
|
||||
class MandatoryError(ValidationError): pass
|
||||
class InvalidSignatureError(ValidationError): pass
|
||||
class RateLimitExceededError(ValidationError): pass
|
||||
|
||||
def get_traceback():
|
||||
import utils
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"creation": "2012-12-20 17:16:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-20 19:24:15",
|
||||
"modified": "2013-12-30 13:48:02",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
|
|
@ -79,11 +79,11 @@
|
|||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "module",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Link",
|
||||
"label": "Module",
|
||||
"oldfieldname": "module",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Module Def",
|
||||
"options": "Module Def",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ wn.core.pages.desktop.render = function() {
|
|||
document.title = "Desktop";
|
||||
var add_icon = function(m) {
|
||||
var module = wn.modules[m];
|
||||
if(!module)
|
||||
if(!module || !module.link)
|
||||
return;
|
||||
if(!module.label)
|
||||
module.label = m;
|
||||
|
|
|
|||
|
|
@ -490,7 +490,16 @@ class Database:
|
|||
return webnotes.conn.sql("""select count(*)
|
||||
from `tab%s`""" % (dt,))[0][0]
|
||||
|
||||
|
||||
|
||||
def get_creation_count(self, doctype, minutes):
|
||||
"""get count of records created in the last x minutes"""
|
||||
from webnotes.utils import now_datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
return webnotes.conn.sql("""select count(name) from `tab{doctype}`
|
||||
where creation >= %s""".format(doctype=doctype),
|
||||
now_datetime() - relativedelta(minutes=minutes))[0][0]
|
||||
|
||||
def get_table_columns(self, doctype):
|
||||
return [r[0] for r in self.sql("DESC `tab%s`" % doctype)]
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
{% block css -%}
|
||||
{% if css %}<style>{{ css }}</style>{% endif %}
|
||||
{%- endblock %}
|
||||
{% block style -%}{%- endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block banner %}
|
||||
|
|
@ -36,5 +37,6 @@
|
|||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% block footer %}{% include "templates/includes/footer.html" %}{% endblock %}
|
||||
{% block script -%}{%- endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -904,7 +904,7 @@ def touch_file(path):
|
|||
with open(path, 'a'):
|
||||
os.utime(path, None)
|
||||
return True
|
||||
|
||||
|
||||
class HashAuthenticatedCommand(object):
|
||||
def __init__(self):
|
||||
if hasattr(self, 'command'):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue