From f3e4c5f7f949ea07e876c51cd085b7d734177740 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 18 May 2021 18:44:15 +0300 Subject: Small fixes --- README.md | 14 ++++---------- servo/models/common.py | 13 ++++++++----- servo/models/note.py | 2 +- servo/models/product.py | 10 ++++++---- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 60f4352..207a1dd 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Main features include: The Obligatory Screenshots ========================== -![Servo Screenshot 1](http://www.servoapp.com/img/screenshots/940/order1.png) -![Servo Screenshot 2](http://www.servoapp.com/img/screenshots/devices.png) -![Servo Screenshot 3](http://www.servoapp.com/img/screenshots/inventory.png) +![Servo Screenshot 1](https://www.servoapp.com/img/screenshots/940/order1.png) +![Servo Screenshot 2](https://www.servoapp.com/img/screenshots/devices.png) +![Servo Screenshot 3](https://www.servoapp.com/img/screenshots/inventory.png) System Requirements @@ -33,12 +33,11 @@ The application is written in Python on top of the excellent [Django web framewo - Memcache - RabbitMQ - uwsgi -- Python 2.7 Installation ============ -Install and start [PostgreSQL](https://www.postgresql.org), [nginx](http://nginx.org), [memcached](https://www.memcached.org), rabbitMQ (only necessary if you want to use automated rules). +Install and start [PostgreSQL](https://www.postgresql.org), [nginx](https://nginx.org), [memcached](https://www.memcached.org), rabbitMQ (only necessary if you want to use automated rules). Then clone the code: @@ -62,11 +61,6 @@ If you want to run rules, set ENABLE_RULES = True and start the worker task: Then fire up your browser and got to [http://localhost:8000/](http://localhost:8000/) -The VMWare Image -================ -You can also download a preconfigured VMWare image [here](http://files.servoapp.com/vmware/). Please read the included README files for instructions. - - Updating ======== First, back up your database: 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: -- cgit v1.2.3