From 96432a9a4ff849da6c3f450253198b83cf3fbde9 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 9 Nov 2015 14:30:30 +0200 Subject: Cleanup --- servo/models/device.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'servo/models') diff --git a/servo/models/device.py b/servo/models/device.py index b7e1ca3..85abeb9 100644 --- a/servo/models/device.py +++ b/servo/models/device.py @@ -2,6 +2,7 @@ import re import gsxws +from gsxws import diagnostics from os.path import basename from django_countries import countries from django.core.validators import RegexValidator @@ -280,7 +281,9 @@ class Device(models.Model): return device def to_gsx(self): - """Returns the corresponding gsxws Product object""" + """ + Returns the corresponding gsxws Product object + """ if len(self.imei): return gsxws.Product(self.imei) return gsxws.Product(self.sn) @@ -472,7 +475,9 @@ class Device(models.Model): return super(Device, self).save(*args, **kwargs) def get_absolute_url(self): - return reverse('devices-view_device', args=[self.product_line, self.slug, self.pk]) + return reverse('devices-view_device', args=[self.product_line, + self.slug, + self.pk]) def get_purchase_country(self): # Return device's purchase country, can be 2-letter code (from checkin) or @@ -485,7 +490,6 @@ class Device(models.Model): return countries.countries.get(self.purchase_country, '') def run_test(self, test_id, request): - from gsxws import diagnostics GsxAccount.default(request.user) diags = diagnostics.Diagnostics(self.sn) diags.shipTo = request.user.location.gsx_shipto @@ -493,7 +497,6 @@ class Device(models.Model): return diags.run_test() def fetch_tests(self, request): - from gsxws import diagnostics GsxAccount.default(request.user) diags = diagnostics.Diagnostics(self.sn) diags.shipTo = request.user.location.gsx_shipto -- cgit v1.2.3