From f3cd067dd262dd0a6384a2122375dc3f10e3ebcf Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 28 Feb 2016 23:10:56 +0200 Subject: Set ActiveManager as default --- servo/models/order.py | 3 +++ servo/models/repair.py | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'servo/models') diff --git a/servo/models/order.py b/servo/models/order.py index c7fb594..aad1932 100644 --- a/servo/models/order.py +++ b/servo/models/order.py @@ -367,6 +367,9 @@ class Order(models.Model): self.set_status(self.queue.status_closed, user) def reopen(self, user): + """ + Re-opens this service order + """ self.state = Order.STATE_OPEN self.closed_at = None self.save() diff --git a/servo/models/repair.py b/servo/models/repair.py index c9bb952..ba52980 100644 --- a/servo/models/repair.py +++ b/servo/models/repair.py @@ -89,7 +89,7 @@ class ActiveManager(models.Manager): GSX repairs that have been submitted, and not marked complete """ use_for_related_fields = True - + def active(self, **kwargs): return self.filter(completed_at=None, **kwargs).exclude(submitted_at=None) @@ -198,8 +198,7 @@ class Repair(models.Model): symptom_code = models.CharField(max_length=7, default='') issue_code = models.CharField(max_length=7, default='') - objects = models.Manager() - active = ActiveManager() + objects = ActiveManager() def is_submitted(self): return self.submitted_at is not None -- cgit v1.2.3