diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-10-22 00:08:24 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-10-22 00:08:24 +0200 |
commit | 5b773f6a3cc454e26693b83169760369cf0a0b62 (patch) | |
tree | 3bedb956e0505accf622a6c42c94f3e613286bd6 /archaeological_files/models.py | |
parent | a82ae23015f8036919bae3c4a4e133e9045e6fcc (diff) | |
download | Ishtar-5b773f6a3cc454e26693b83169760369cf0a0b62.tar.bz2 Ishtar-5b773f6a3cc454e26693b83169760369cf0a0b62.zip |
Djangoization - Major refactoring (step 15)
* works on dashboards
Diffstat (limited to 'archaeological_files/models.py')
-rw-r--r-- | archaeological_files/models.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py index 0b95c021a..a91f6ed69 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -180,6 +180,7 @@ class FileByDepartment(models.Model): class FileDashboard: def __init__(self): + from archaeological_operations.models import AdministrativeAct main_dashboard = Dashboard(File) self.total_number = main_dashboard.total_number @@ -266,7 +267,8 @@ class FileDashboard: self.rescue['with_associated_operation'] = rescues\ .filter(operations__isnull=False).count() - self.rescue['with_associated_operation_percent'] = round( + if self.rescue['total_number']: + self.rescue['with_associated_operation_percent'] = round( float(self.rescue['with_associated_operation'])\ /self.rescue['total_number']*100, 2) |