aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
Diffstat (limited to 'servo')
-rw-r--r--servo/forms/product.py2
-rw-r--r--servo/models/device.py4
-rw-r--r--servo/models/queue.py6
-rw-r--r--servo/views/device.py2
-rw-r--r--servo/views/order.py2
-rw-r--r--servo/views/product.py2
6 files changed, 9 insertions, 9 deletions
diff --git a/servo/forms/product.py b/servo/forms/product.py
index 7e0f52e..480240d 100644
--- a/servo/forms/product.py
+++ b/servo/forms/product.py
@@ -31,7 +31,7 @@ class ProductSearchForm(forms.Form):
def __init__(self, *args, **kwargs):
super(ProductSearchForm, self).__init__(*args, **kwargs)
- tags = TaggedItem.objects.filter(content_type__model="product").distinct("tag")
+ tags = TaggedItem.objects.filter(ref="product").distinct("tag")
self.fields['tag'].queryset = tags
diff --git a/servo/models/device.py b/servo/models/device.py
index a506874..148684d 100644
--- a/servo/models/device.py
+++ b/servo/models/device.py
@@ -206,7 +206,7 @@ class Device(models.Model):
@property
def tag_choices(self):
- return TaggedItem.objects.filter(content_type__model="device").distinct("tag")
+ return TaggedItem.objects.filter(ref="device").distinct("tag")
def add_tags(self, tags):
tags = [x for x in tags if x != ''] # Filter out empty tags
@@ -528,7 +528,7 @@ class Device(models.Model):
return results
- def __unicode__(self):
+ def __str__(self):
return '%s (%s)' % (self.description, self.sn)
class Meta:
diff --git a/servo/models/queue.py b/servo/models/queue.py
index 3e74783..8eefab6 100644
--- a/servo/models/queue.py
+++ b/servo/models/queue.py
@@ -167,7 +167,7 @@ class Queue(models.Model):
count = self.order_set.filter(state__lt=max_state).count()
return count if count > 0 else ''
- def __unicode__(self):
+ def __str__(self):
return self.title
class Meta:
@@ -222,7 +222,7 @@ class Status(models.Model):
def get_admin_url(self):
return reverse('admin-edit_status', args=[self.pk])
- def __unicode__(self):
+ def __str__(self):
return self.title
class Meta:
@@ -261,7 +261,7 @@ class QueueStatus(models.Model):
sec = self.limit_yellow * self.limit_factor
return timezone.now() + timedelta(seconds=sec)
- def __unicode__(self):
+ def __str__(self):
return self.status.title
class Meta:
diff --git a/servo/views/device.py b/servo/views/device.py
index dd69414..f02182a 100644
--- a/servo/views/device.py
+++ b/servo/views/device.py
@@ -55,7 +55,7 @@ def prep_list_view(request, product_line=None, model=None):
product_lines = gsxws.products.models()
if product_line is None:
- product_line = product_lines.keys()[0]
+ product_line = list(product_lines.keys())[0]
models = model_from_slug(product_line)
diff --git a/servo/views/order.py b/servo/views/order.py
index ff1c216..4db8c4a 100644
--- a/servo/views/order.py
+++ b/servo/views/order.py
@@ -742,7 +742,7 @@ def add_part(request, pk, device, code):
try:
tag, created = TaggedItem.objects.get_or_create(
- content_type__model="product",
+ ref="product",
object_id=product.pk,
tag=device.description
)
diff --git a/servo/views/product.py b/servo/views/product.py
index 4c7f96f..47b9018 100644
--- a/servo/views/product.py
+++ b/servo/views/product.py
@@ -82,7 +82,7 @@ def tags(request):
Returns all product tags
"""
from servo.lib.utils import json_response
- tags = TaggedItem.objects.filter(content_type__model="product")
+ tags = TaggedItem.objects.filter(ref="product")
tags = tags.distinct("tag").values_list("tag", flat=True)
return json_response(list(tags))