add MapUpdate
This commit is contained in:
parent
e1b776a03c
commit
375454c3f1
5 changed files with 97 additions and 5 deletions
22
src/c3nav/mapdata/models/update.py
Normal file
22
src/c3nav/mapdata/models/update.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class MapUpdate(models.Model):
|
||||
"""
|
||||
A map update. created whenever mapdata is changed.
|
||||
"""
|
||||
datetime = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT)
|
||||
type = models.CharField(max_length=32)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Map update')
|
||||
verbose_name_plural = _('Map updates')
|
||||
default_related_name = 'mapupdates'
|
||||
get_latest_by = 'datetime'
|
||||
|
||||
def save(self, **kwargs):
|
||||
if self.pk is not None:
|
||||
raise TypeError
|
Loading…
Add table
Add a link
Reference in a new issue