Formatting. (line-lenght, comments)

This commit is contained in:
Marcus Scholz 2020-09-10 00:21:26 +02:00
parent 64510898bb
commit 240b61f428

View File

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