Commit c4a2666e authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'refactor-announcements-datetime' into 'master'

Bound announcements on datetime instead of date

See merge request !438
parents 6ab4a53e f30f91b4
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-02 11:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('announcements', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='announcement',
name='since',
field=models.DateTimeField(default=django.utils.timezone.now, help_text='Hide this announcement before this time.', verbose_name='Display since'),
),
migrations.AlterField(
model_name='announcement',
name='until',
field=models.DateTimeField(blank=True, help_text='Hide this announcement after this time.', null=True, verbose_name='Display until'),
),
]
......@@ -14,13 +14,13 @@ class Announcement(models.Model, metaclass=ModelTranslateMeta):
max_length=500,
)
since = models.DateField(
since = models.DateTimeField(
verbose_name=_('Display since'),
help_text=_("Hide this announcement before this time."),
default=timezone.now,
)
until = models.DateField(
until = models.DateTimeField(
verbose_name=_('Display until'),
help_text=_("Hide this announcement after this time."),
blank=True,
......@@ -47,5 +47,5 @@ class Announcement(models.Model, metaclass=ModelTranslateMeta):
@property
def is_visible(self):
"""Is this announcement currently visible"""
return ((self.until is None or self.until > timezone.now().date()) and
(self.since is None or self.since <= timezone.now().date()))
return ((self.until is None or self.until > timezone.now()) and
(self.since is None or self.since <= timezone.now()))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment