Compare commits
No commits in common. "ab0d73885172418ea3130a93d353182acccc4e04" and "bcc5f767ba283ed38565360df5f3ab274aba8c9c" have entirely different histories.
ab0d738851
...
bcc5f767ba
@ -1,23 +0,0 @@
|
|||||||
# Generated by Django 3.1.2 on 2020-10-25 17:16
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('countdown', '0005_countdownitem_recurring_until'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='countdownitem',
|
|
||||||
name='recurring_period',
|
|
||||||
field=models.CharField(blank=True, default='', max_length=64),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='countdownitem',
|
|
||||||
name='reminder_target',
|
|
||||||
field=models.CharField(blank=True, default='', max_length=64),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,8 +1,14 @@
|
|||||||
"""Countdown item models."""
|
"""Countdown item models."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger('countdown.models')
|
||||||
|
|
||||||
|
|
||||||
class CountdownItem(models.Model):
|
class CountdownItem(models.Model):
|
||||||
"""Track points in time."""
|
"""Track points in time."""
|
||||||
|
|
||||||
@ -13,13 +19,13 @@ class CountdownItem(models.Model):
|
|||||||
sent_reminder = models.BooleanField(default=False)
|
sent_reminder = models.BooleanField(default=False)
|
||||||
|
|
||||||
reminder_message = models.TextField(default="")
|
reminder_message = models.TextField(default="")
|
||||||
reminder_target = models.CharField(max_length=64, blank=True, default='')
|
reminder_target = models.CharField(max_length=64, default='')
|
||||||
|
|
||||||
recurring_period = models.CharField(max_length=64, blank=True, default='')
|
recurring_period = models.CharField(max_length=64, default='')
|
||||||
recurring_until = models.DateTimeField(null=True, blank=True, default=None)
|
recurring_until = models.DateTimeField(null=True, blank=True, default=None)
|
||||||
|
|
||||||
created_time = models.DateTimeField(auto_now_add=True)
|
created_time = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Summarize object."""
|
"""String representation."""
|
||||||
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))
|
return "{0:s} @ {1:s}".format(self.name, timezone.localtime(self.at_time).strftime('%Y-%m-%d %H:%M:%S %Z'))
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
"""REST serializers for countdown items."""
|
|
||||||
from rest_framework import serializers
|
|
||||||
|
|
||||||
from countdown.models import CountdownItem
|
|
||||||
|
|
||||||
|
|
||||||
class CountdownItemSerializer(serializers.ModelSerializer):
|
|
||||||
"""Countdown item serializer for the REST API."""
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
"""Meta options."""
|
|
||||||
|
|
||||||
model = CountdownItem
|
|
||||||
fields = '__all__'
|
|
@ -1,12 +0,0 @@
|
|||||||
"""URL patterns for the countdown views."""
|
|
||||||
from django.conf.urls import include, url
|
|
||||||
from rest_framework.routers import DefaultRouter
|
|
||||||
|
|
||||||
from countdown.views import CountdownItemViewSet
|
|
||||||
|
|
||||||
router = DefaultRouter()
|
|
||||||
router.register(r'items', CountdownItemViewSet)
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
url(r'^api/', include(router.urls)),
|
|
||||||
]
|
|
@ -1,16 +0,0 @@
|
|||||||
"""Provide an interface to countdown items."""
|
|
||||||
# from rest_framework.decorators import action
|
|
||||||
# from rest_framework.response import Response
|
|
||||||
from rest_framework.permissions import IsAuthenticated
|
|
||||||
from rest_framework.viewsets import ReadOnlyModelViewSet
|
|
||||||
|
|
||||||
from countdown.models import CountdownItem
|
|
||||||
from countdown.serializers import CountdownItemSerializer
|
|
||||||
|
|
||||||
|
|
||||||
class CountdownItemViewSet(ReadOnlyModelViewSet):
|
|
||||||
"""Provide list and detail actions for countdown items."""
|
|
||||||
|
|
||||||
queryset = CountdownItem.objects.all()
|
|
||||||
serializer_class = CountdownItemSerializer
|
|
||||||
permission_classes = [IsAuthenticated]
|
|
@ -1,9 +1,11 @@
|
|||||||
"""General/baselite/site-wide URLs."""
|
"""General/baselite/site-wide URLs."""
|
||||||
from adminplus.sites import AdminSitePlus
|
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from adminplus.sites import AdminSitePlus
|
||||||
|
|
||||||
admin.site = AdminSitePlus()
|
admin.site = AdminSitePlus()
|
||||||
admin.sites.site = admin.site
|
admin.sites.site = admin.site
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
@ -11,7 +13,6 @@ admin.autodiscover()
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
|
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
|
||||||
|
|
||||||
url(r'^countdown/', include('countdown.urls')),
|
|
||||||
url(r'^dice/', include('dice.urls')),
|
url(r'^dice/', include('dice.urls')),
|
||||||
url(r'^dispatch/', include('dispatch.urls')),
|
url(r'^dispatch/', include('dispatch.urls')),
|
||||||
url(r'^itemsets/', include('facts.urls')),
|
url(r'^itemsets/', include('facts.urls')),
|
||||||
|
@ -13,13 +13,13 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='pilog',
|
model_name='pilog',
|
||||||
name='simulation_x',
|
name='simulation_x',
|
||||||
field=models.DecimalField(decimal_places=10, default=-1.0, max_digits=11),
|
field=models.DecimalField(decimal_places=10, default=0.0, max_digits=11),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='pilog',
|
model_name='pilog',
|
||||||
name='simulation_y',
|
name='simulation_y',
|
||||||
field=models.DecimalField(decimal_places=10, default=-1.0, max_digits=11),
|
field=models.DecimalField(decimal_places=10, default=0.0, max_digits=11),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user