aboutsummaryrefslogtreecommitdiffstats
path: root/servo
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2021-05-18 18:44:15 +0300
committerFilipp Lepalaan <filipp@mac.com>2021-05-18 18:44:15 +0300
commitf3e4c5f7f949ea07e876c51cd085b7d734177740 (patch)
tree16e5fa2403b8cb51d2d90426dde98dce6dcc4f4d /servo
parentd2ca08edbef7e08afbeb18a1dd8e6cabe1f16a3f (diff)
downloadServo-f3e4c5f7f949ea07e876c51cd085b7d734177740.tar.gz
Servo-f3e4c5f7f949ea07e876c51cd085b7d734177740.tar.bz2
Servo-f3e4c5f7f949ea07e876c51cd085b7d734177740.zip
Small fixes
Diffstat (limited to 'servo')
-rw-r--r--servo/models/common.py13
-rw-r--r--servo/models/note.py2
-rw-r--r--servo/models/product.py10
3 files changed, 15 insertions, 10 deletions
diff --git a/servo/models/common.py b/servo/models/common.py
index 520b769..1d3e17b 100644
--- a/servo/models/common.py
+++ b/servo/models/common.py
@@ -46,6 +46,7 @@ class CsvTable(object):
self.header = u''
def padrow(self, row):
+ """Pad row to self.colwdith"""
r = []
for c in row:
r.append(unicode(c).ljust(self.colwidth))
@@ -761,7 +762,9 @@ class Template(models.Model):
class Attachment(models.Model):
- """A file attached to something."""
+ """
+ A file attached to something.
+ """
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
@@ -786,7 +789,7 @@ class Attachment(models.Model):
attachment.save()
def save(self, *args, **kwargs):
- DENIED_EXTENSIONS = ('.htm', '.html', '.py', '.js',)
+ DENIED_EXTENSIONS = ('.htm', '.html', '.py', '.js', '.exe', '.sh',)
filename = self.content.name.lower()
ext = os.path.splitext(filename)[1]
@@ -798,10 +801,10 @@ class Attachment(models.Model):
def __str__(self):
return os.path.basename(self.content.name)
- def __str__(self):
- return unicode(self).encode('utf-8')
-
def from_url(self, url):
+ """
+ Downloads a file and creates an attachment
+ """
pass
def get_absolute_url(self):
diff --git a/servo/models/note.py b/servo/models/note.py
index 77865cd..da71bd6 100644
--- a/servo/models/note.py
+++ b/servo/models/note.py
@@ -561,7 +561,7 @@ class Note(MPTTModel):
else:
return "/notes/saved/%d/view/" % self.pk
- def __unicode__(self):
+ def __str__(self):
return str(self.pk)
class Meta:
diff --git a/servo/models/product.py b/servo/models/product.py
index 7ec2b30..83bef0e 100644
--- a/servo/models/product.py
+++ b/servo/models/product.py
@@ -202,12 +202,14 @@ class Product(AbstractBaseProduct):
categories = models.ManyToManyField(
"ProductCategory",
blank=True,
- verbose_name=_("Categories")
+ verbose_name=_("Categories"),
+ help_text=_("Product categories"),
)
device_models = models.ManyToManyField(
"DeviceGroup",
blank=True,
- verbose_name=_("Device models")
+ verbose_name=_("Device models"),
+ help_text=_("Compatible with these devices"),
)
tags = GenericRelation(TaggedItem)
photo = models.ImageField(
@@ -534,7 +536,7 @@ class Product(AbstractBaseProduct):
except Exception as e:
print(e)
- def __unicode__(self):
+ def __str__(self):
return u'%s %s' % (self.code, self.title)
class Meta:
@@ -585,7 +587,7 @@ class ProductCategory(MPTTModel):
self.slug = slugify(self.title[:50])
return super(ProductCategory, self).save(*args, **kwargs)
- def __unicode__(self):
+ def __str__(self):
return self.title
class Meta: