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 | 4ccbb4bef309571159c9558cca5da04987a68646 (patch) | |
| tree | 3bedb956e0505accf622a6c42c94f3e613286bd6 /archaeological_files/models.py | |
| parent | 39e0c9cf302f8b468e116047eef18f42d712166e (diff) | |
| download | Ishtar-4ccbb4bef309571159c9558cca5da04987a68646.tar.bz2 Ishtar-4ccbb4bef309571159c9558cca5da04987a68646.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) |
