add SiteUpdate model
This commit is contained in:
parent
62c8456675
commit
946de86bc2
5 changed files with 44 additions and 0 deletions
0
src/c3nav/site/management/__init__.py
Normal file
0
src/c3nav/site/management/__init__.py
Normal file
0
src/c3nav/site/management/commands/__init__.py
Normal file
0
src/c3nav/site/management/commands/__init__.py
Normal file
15
src/c3nav/site/management/commands/createsiteupdate.py
Normal file
15
src/c3nav/site/management/commands/createsiteupdate.py
Normal 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.')
|
22
src/c3nav/site/migrations/0003_siteupdate.py
Normal file
22
src/c3nav/site/migrations/0003_siteupdate.py
Normal 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')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue