add SiteUpdate model

This commit is contained in:
Laura Klünder 2017-12-24 01:13:44 +01:00
parent 62c8456675
commit 946de86bc2
5 changed files with 44 additions and 0 deletions

View file

View file

@ -0,0 +1,15 @@
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'create a site update, asking users to reload the page'
def handle(self, *args, **options):
result = input('Type YES to create a new site update: ')
if result == 'YES':
from c3nav.mapdata.models import SiteUpdate
SiteUpdate.objects.create()
print('New site update created.')
else:
print('Aborted.')

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-24 00:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('site', '0002_announcement_tweaks'),
]
operations = [
migrations.CreateModel(
name='SiteUpdate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='create')),
],
),
]

View file

@ -43,3 +43,10 @@ class Announcement(models.Model):
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
cache.delete('site:announcement')
class SiteUpdate(models.Model):
"""
A site update that asks the user to reload the page.
"""
created = models.DateTimeField(auto_now_add=True, verbose_name=_('create'))