lostplaces-backend/django_lostplaces/lostplaces/models/abstract_models.py

64 lines
1.7 KiB
Python
Raw Normal View History

Squashed commit of the following: commit 0d62e72d72922a84e41c9f2cc21977b794784d1c Merge: 79fee63 85f2a81 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:55:18 2020 +0200 Merge branch 'develop' into refactor/models commit 79fee631d7ac28509067ecdd74078f1a2f6e0be2 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:54:32 2020 +0200 Updating references for related name commit 8e07e79df2de2601f2e2eadfdd37eb7c719c51b0 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:53:31 2020 +0200 Generating of related names fix commit 5fd804f37a805ae4707e13c3d941bdde3660afea Merge: 8cc1d3e 3b526c9 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:01:48 2020 +0200 Merge branch 'develop' into refactor/models commit 8cc1d3e690211dba6451e86569f00078b23e0621 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 20:21:08 2020 +0200 Tests commit 7c0591e5397f892b1f6fb80725a693c21f90468a Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 23:53:39 2020 +0200 Testing PlaceAsset commit 2e7b49ad1a15173565c81e7eb8bb3f35b9f622a6 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:25:08 2020 +0200 Restructuring models commit eb7d03b08b326f9115e70d0fd9ed5d0fc229a362 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:01:54 2020 +0200 Abstract class Expireable commit 2b51e741bb5734c5a578beeadef7819fe58b2223 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 21:54:07 2020 +0200 Abstract Model for PlaceAsset (i.e. Photoalbums)
2020-09-22 21:56:51 +02:00
from django.db import models
2020-10-06 17:01:29 +02:00
from django.utils.translation import ugettext_lazy as _
Squashed commit of the following: commit 0d62e72d72922a84e41c9f2cc21977b794784d1c Merge: 79fee63 85f2a81 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:55:18 2020 +0200 Merge branch 'develop' into refactor/models commit 79fee631d7ac28509067ecdd74078f1a2f6e0be2 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:54:32 2020 +0200 Updating references for related name commit 8e07e79df2de2601f2e2eadfdd37eb7c719c51b0 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:53:31 2020 +0200 Generating of related names fix commit 5fd804f37a805ae4707e13c3d941bdde3660afea Merge: 8cc1d3e 3b526c9 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:01:48 2020 +0200 Merge branch 'develop' into refactor/models commit 8cc1d3e690211dba6451e86569f00078b23e0621 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 20:21:08 2020 +0200 Tests commit 7c0591e5397f892b1f6fb80725a693c21f90468a Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 23:53:39 2020 +0200 Testing PlaceAsset commit 2e7b49ad1a15173565c81e7eb8bb3f35b9f622a6 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:25:08 2020 +0200 Restructuring models commit eb7d03b08b326f9115e70d0fd9ed5d0fc229a362 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:01:54 2020 +0200 Abstract class Expireable commit 2b51e741bb5734c5a578beeadef7819fe58b2223 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 21:54:07 2020 +0200 Abstract Model for PlaceAsset (i.e. Photoalbums)
2020-09-22 21:56:51 +02:00
from django.core.validators import MaxValueValidator, MinValueValidator
from taggit.managers import TaggableManager
class Taggable(models.Model):
'''
This abstract model represtens an object that is taggalble
using django-taggit
'''
class Meta:
abstract = True
tags = TaggableManager(blank=True)
class Mapable(models.Model):
'''
This abstract model class represents an object that can be
displayed on a map.
'''
class Meta:
abstract = True
name = models.CharField(max_length=50)
latitude = models.FloatField(
validators=[
MinValueValidator(-90),
MaxValueValidator(90)
2020-10-06 17:01:29 +02:00
],
help_text=_('Latitude in decimal format: e. g. 41.40338')
Squashed commit of the following: commit 0d62e72d72922a84e41c9f2cc21977b794784d1c Merge: 79fee63 85f2a81 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:55:18 2020 +0200 Merge branch 'develop' into refactor/models commit 79fee631d7ac28509067ecdd74078f1a2f6e0be2 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:54:32 2020 +0200 Updating references for related name commit 8e07e79df2de2601f2e2eadfdd37eb7c719c51b0 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:53:31 2020 +0200 Generating of related names fix commit 5fd804f37a805ae4707e13c3d941bdde3660afea Merge: 8cc1d3e 3b526c9 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:01:48 2020 +0200 Merge branch 'develop' into refactor/models commit 8cc1d3e690211dba6451e86569f00078b23e0621 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 20:21:08 2020 +0200 Tests commit 7c0591e5397f892b1f6fb80725a693c21f90468a Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 23:53:39 2020 +0200 Testing PlaceAsset commit 2e7b49ad1a15173565c81e7eb8bb3f35b9f622a6 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:25:08 2020 +0200 Restructuring models commit eb7d03b08b326f9115e70d0fd9ed5d0fc229a362 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:01:54 2020 +0200 Abstract class Expireable commit 2b51e741bb5734c5a578beeadef7819fe58b2223 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 21:54:07 2020 +0200 Abstract Model for PlaceAsset (i.e. Photoalbums)
2020-09-22 21:56:51 +02:00
)
longitude = models.FloatField(
validators=[
MinValueValidator(-180),
MaxValueValidator(180)
2020-10-06 17:01:29 +02:00
],
help_text=_('Longitude in decimal format: e. g. 2.17403')
Squashed commit of the following: commit 0d62e72d72922a84e41c9f2cc21977b794784d1c Merge: 79fee63 85f2a81 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:55:18 2020 +0200 Merge branch 'develop' into refactor/models commit 79fee631d7ac28509067ecdd74078f1a2f6e0be2 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:54:32 2020 +0200 Updating references for related name commit 8e07e79df2de2601f2e2eadfdd37eb7c719c51b0 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:53:31 2020 +0200 Generating of related names fix commit 5fd804f37a805ae4707e13c3d941bdde3660afea Merge: 8cc1d3e 3b526c9 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 21:01:48 2020 +0200 Merge branch 'develop' into refactor/models commit 8cc1d3e690211dba6451e86569f00078b23e0621 Author: reverend <reverend@reverend2048.de> Date: Tue Sep 22 20:21:08 2020 +0200 Tests commit 7c0591e5397f892b1f6fb80725a693c21f90468a Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 23:53:39 2020 +0200 Testing PlaceAsset commit 2e7b49ad1a15173565c81e7eb8bb3f35b9f622a6 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:25:08 2020 +0200 Restructuring models commit eb7d03b08b326f9115e70d0fd9ed5d0fc229a362 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 22:01:54 2020 +0200 Abstract class Expireable commit 2b51e741bb5734c5a578beeadef7819fe58b2223 Author: reverend <reverend@reverend2048.de> Date: Fri Sep 18 21:54:07 2020 +0200 Abstract Model for PlaceAsset (i.e. Photoalbums)
2020-09-22 21:56:51 +02:00
)
class Submittable(models.Model):
'''
This abstract model class represents an object that can be submitted by
an explorer.
'''
class Meta:
abstract = True
submitted_when = models.DateTimeField(auto_now_add=True, null=True)
submitted_by = models.ForeignKey(
'Explorer',
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='%(class)ss'
)
class Expireable(models.Model):
"""
Base class for things that can expire, i.e. VouchersAv
"""
created_when = models.DateTimeField(auto_now_add=True)
expires_when = models.DateTimeField()