diff --git a/lostplaces/lostplaces_app/models.py b/lostplaces/lostplaces_app/models.py index 81244ad..47133e0 100644 --- a/lostplaces/lostplaces_app/models.py +++ b/lostplaces/lostplaces_app/models.py @@ -1,7 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -''' (Data)models which describe the structure of data to be saved into database. ''' +''' +(Data)models which describe the structure of data to be saved into +database. +''' import os import uuid @@ -27,8 +30,9 @@ class Explorer(AbstractUser): class Voucher(models.Model): """ Vouchers are authorization tokens to allow the registration of new users. - A voucher has a code, a creation and a deletion date, which are all positional. - Creation date is being set automatically during voucher creation. + A voucher has a code, a creation and a deletion date, which are all + positional. Creation date is being set automatically during voucher + creation. """ code = models.CharField(unique=True, max_length=30) @@ -68,8 +72,8 @@ class Place (models.Model): description = models.TextField() tags = TaggableManager(blank=True) - # Get center position of LP-geocoordinates. + # Get center position of LP-geocoordinates. def average_latlon(place_list): amount = len(place_list) # Init fill values to prevent None @@ -126,7 +130,6 @@ class PlaceImage (models.Model): return ' '.join([self.place.name, str(self.pk)]) # These two auto-delete files from filesystem when they are unneeded: - @receiver(models.signals.post_delete, sender=PlaceImage) def auto_delete_file_on_delete(sender, instance, **kwargs): """ @@ -157,7 +160,6 @@ def auto_delete_file_on_change(sender, instance, **kwargs): if os.path.isfile(old_file.path): os.remove(old_file.path) - class ExternalLink(models.Model): url = models.URLField(max_length=200) label = models.CharField(max_length=100) @@ -176,4 +178,4 @@ class PhotoAlbum(ExternalLink): on_delete=models.CASCADE, related_name='photo_albums', null=True - ) \ No newline at end of file + )