Debug messages
This commit is contained in:
parent
8e42920ced
commit
0d58e0d5a5
@ -77,7 +77,10 @@ class InvoiceDependencies(object):
|
||||
|
||||
def set_may_have_changed(self, kwargs):
|
||||
inventory_ids = set([i.pk for i in self.get_related_invoices() if i])
|
||||
Inventory.objects.filter(pk__in=inventory_ids, may_have_changed=False).update(may_have_changed=True)
|
||||
if inventory_ids:
|
||||
if settings.DEBUG:
|
||||
print("May have changed: " + str(inventory_ids))
|
||||
Inventory.objects.filter(pk__in=inventory_ids, may_have_changed=False).update(may_have_changed=True)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
assert isinstance(self, models.Model) and isinstance(self, InvoiceDependencies)
|
||||
|
12
main/urls.py
12
main/urls.py
@ -1,14 +1,22 @@
|
||||
import trace
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from django.conf.urls import url
|
||||
|
||||
from tallybill import settings
|
||||
from . import views
|
||||
|
||||
|
||||
def time_measure(view):
|
||||
def _wrapper(*args, **kwargs):
|
||||
b = datetime.now()
|
||||
ret = view(*args, **kwargs)
|
||||
print("View '%s' took %.2fms" % (view.__name__, (datetime.now() - b).total_seconds() * 1000.))
|
||||
try:
|
||||
ret = view(*args, **kwargs)
|
||||
except Exception as e:
|
||||
print(traceback.format_exc(100, e))
|
||||
raise e
|
||||
if settings.DEBUG:
|
||||
print("View '%s' took %.2fms" % (view.__name__, (datetime.now() - b).total_seconds() * 1000.))
|
||||
return ret
|
||||
|
||||
return _wrapper
|
||||
|
Loading…
x
Reference in New Issue
Block a user