reverend
5f304b91f3
commit 0d62e72d72922a84e41c9f2cc21977b794784d1c Merge: 79fee6385f2a81
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: 8cc1d3e3b526c9
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)
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
|
|
from django.db import models
|
|
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)
|
|
]
|
|
)
|
|
longitude = models.FloatField(
|
|
validators=[
|
|
MinValueValidator(-180),
|
|
MaxValueValidator(180)
|
|
]
|
|
)
|
|
|
|
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() |