2
0
Fork 0

Compare commits

..

No commits in common. "595e0a47b9fb6b7a0846db411d278bc77a653c67" and "7e978dd657293d34c65bd43491e70473f7ad04a5" have entirely different histories.

66 changed files with 144 additions and 302 deletions

View File

@ -1,15 +1,10 @@
**/__pycache__ **/__pycache__
*.bkp
.dockerignore .dockerignore
.drone.yml
.editorconfig
.git* .git*
.idea
Dockerfile Dockerfile
Dockerfile-dev Dockerfile-dev
README.md README.md
db.sqlite3 db.sqlite3
docker-compose.yml docker-compose.yml
env env
setup.cfg
storage storage

View File

@ -4,15 +4,10 @@ kind: pipeline
type: docker type: docker
name: default name: default
steps: clone:
- name: check style disable: yes
image: python:3.12-alpine
commands:
- apk add --no-cache git # required by isort to skip files in .gitignore
- pip install black isort
- black --check .
- isort -c .
steps:
- name: deploy staging - name: deploy staging
image: ghcr.io/appleboy/drone-ssh image: ghcr.io/appleboy/drone-ssh
environment: environment:
@ -31,8 +26,6 @@ steps:
when: when:
branch: branch:
- main - main
event:
- push
- name: deploy production - name: deploy production
image: ghcr.io/appleboy/drone-ssh image: ghcr.io/appleboy/drone-ssh
@ -42,10 +35,7 @@ steps:
when: when:
branch: branch:
- live - live
event:
- push
trigger: trigger:
event: event:
- pull_request
- push - push

View File

@ -1,5 +0,0 @@
root = true
[*.html]
indent_size = 4
indent_style = space

3
.gitignore vendored
View File

@ -158,6 +158,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# E.g. copies of old dev database
*.bkp

View File

@ -1,4 +1,6 @@
FROM python:3.12-alpine3.19 FROM python:3.10-alpine3.17
RUN apk add --no-cache git
RUN adduser -h /opt/shiftregister -D shiftregister RUN adduser -h /opt/shiftregister -D shiftregister

View File

@ -1,4 +1,6 @@
FROM python:3.12-alpine3.19 FROM python:3.10-alpine3.17
RUN apk add --no-cache git
RUN adduser -h /home/shiftregister -D shiftregister RUN adduser -h /home/shiftregister -D shiftregister

View File

@ -1,6 +1,6 @@
# shiftregister # shiftregister
![kontakt logo with its left half rotated 180 degrees, resembling the left shift operator](shiftregister/core/static/tonkakt.svg) ![kontakt logo with its left half rotated 180 degrees, resembling the left shift operator](assets/tonkakt.svg)
## [CI Mirror](https://git.luj0ga.de/kontakt/shiftregister) / [Drone CI](https://ci.luj0ga.de/kontakt/shiftregister) ## [CI Mirror](https://git.luj0ga.de/kontakt/shiftregister) / [Drone CI](https://ci.luj0ga.de/kontakt/shiftregister)

View File

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 903 B

View File

@ -1,9 +1,9 @@
amqp==5.1.1 amqp==5.1.1
asgiref==3.8.1 asgiref==3.5.0
async-timeout==4.0.2 async-timeout==4.0.2
beautifulsoup4==4.12.3 beautifulsoup4==4.12.2
billiard==4.2.0 billiard==3.6.4.0
celery==5.4.0 celery==5.2.6
certifi==2021.10.8 certifi==2021.10.8
charset-normalizer==2.0.12 charset-normalizer==2.0.12
click==8.1.2 click==8.1.2
@ -11,31 +11,31 @@ click-didyoumean==0.3.0
click-plugins==1.1.1 click-plugins==1.1.1
click-repl==0.2.0 click-repl==0.2.0
Deprecated==1.2.13 Deprecated==1.2.13
Django==5.0.4 Django==4.0.4
django-dynamic-preferences==1.16.0 django-dynamic-preferences==1.15.0
django-phonenumber-field==7.3.0 django-phonenumber-field==6.1.0
icalendar==5.0.12 icalendar==4.0.9
idna==3.3 idna==3.3
kombu==5.3.7 kombu==5.2.4
librabbitmq==2.0.0
packaging==21.3 packaging==21.3
persisting-theory==1.0 persisting-theory==1.0
phonenumbers==8.12.47 phonenumbers==8.12.47
prompt-toolkit==3.0.29 prompt-toolkit==3.0.29
psycopg2-binary==2.9.9 psycopg2-binary==2.9.3
pyparsing==3.0.8 pyparsing==3.0.8
pypng==0.20220715.0 pypng==0.20220715.0
python-dateutil==2.8.2 python-dateutil==2.8.2
pytz==2022.1 pytz==2022.1
qrcode==7.4.2 qrcode==7.4.2
redis==5.0.4 redis==4.2.2
requests==2.31.0 requests==2.27.1
sentry-sdk==2.0.1 sentry-sdk==1.5.10
six==1.16.0 six==1.16.0
soupsieve==2.4.1 soupsieve==2.4.1
sqlparse==0.4.2 sqlparse==0.4.2
typing_extensions==4.11.0 typing_extensions==4.5.0
tzdata==2024.1 urllib3==1.26.9
urllib3==2.2.1 vine==5.0.0
vine==5.1.0
wcwidth==0.2.5 wcwidth==0.2.5
wrapt==1.14.0 wrapt==1.14.0

View File

@ -1,4 +0,0 @@
[isort]
line_length=88
profile=black
skip_gitignore=True

View File

@ -1,7 +1,7 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.admin import DateFieldListFilter from django.contrib.admin import DateFieldListFilter
from .models import Helper, LoginToken, Message, Room, Shift, ShiftRegistration from .models import Room, Shift, Helper, ShiftRegistration, Message, LoginToken
@admin.register(Room) @admin.register(Room)

View File

@ -1,5 +1,4 @@
from django.conf import settings from django.conf import settings
from .models import LoginToken from .models import LoginToken

View File

@ -1,8 +1,7 @@
import datetime
import phonenumbers
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences import types
import phonenumbers
import datetime
helper = types.Section("helper") helper = types.Section("helper")

View File

@ -1,10 +1,9 @@
from django import forms from django import forms
from django.core.exceptions import ValidationError from .models import Helper
from dynamic_preferences.registries import global_preferences_registry
from phonenumber_field.formfields import PhoneNumberField from phonenumber_field.formfields import PhoneNumberField
from phonenumber_field.validators import validate_international_phonenumber from phonenumber_field.validators import validate_international_phonenumber
from django.core.exceptions import ValidationError
from .models import Helper from dynamic_preferences.registries import global_preferences_registry
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,9 +1,8 @@
# Generated by Django 4.0.4 on 2022-04-27 14:11 # Generated by Django 4.0.4 on 2022-04-27 14:11
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
import phonenumber_field.modelfields import phonenumber_field.modelfields
from django.db import migrations, models
import shiftregister.app.models import shiftregister.app.models

View File

@ -1,13 +1,12 @@
import secrets
from datetime import timedelta
from django.db import models from django.db import models
from django.db.models import Case, Count, ExpressionWrapper, F, Q, When import secrets
from django.shortcuts import reverse from django.shortcuts import reverse
from django.template import Context, Template from datetime import timedelta
from django.utils import timezone from django.utils import timezone
from dynamic_preferences.registries import global_preferences_registry from django.db.models import F, Count, Q, ExpressionWrapper, Case, When
from django.template import Context, Template
from phonenumber_field.modelfields import PhoneNumberField from phonenumber_field.modelfields import PhoneNumberField
from dynamic_preferences.registries import global_preferences_registry
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -2,9 +2,7 @@ from django.db.models.signals import pre_save
from django.dispatch import receiver from django.dispatch import receiver
from django.shortcuts import reverse from django.shortcuts import reverse
from django.template import Context, Template from django.template import Context, Template
from shiftregister.core.signals import populate_nav from shiftregister.core.signals import populate_nav
from .models import Message, Shift from .models import Message, Shift

View File

@ -1,7 +1,7 @@
from datetime import timezone from datetime import timezone
import requests
from django.conf import settings from django.conf import settings
import requests
BASE_URL = "https://api.sipgate.com/v2" BASE_URL = "https://api.sipgate.com/v2"

View File

@ -1,6 +1,7 @@
import requests
from django.conf import settings from django.conf import settings
from phonenumber_field.phonenumber import PhoneNumber from phonenumber_field.phonenumber import PhoneNumber
import requests
BASE_URL = "https://api.sipgate.com/v2" BASE_URL = "https://api.sipgate.com/v2"

View File

@ -1,12 +1,11 @@
import sentry_sdk
from celery import shared_task from celery import shared_task
from .models import Message, ShiftRegistration
from django.conf import settings from django.conf import settings
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from .models import Message, ShiftRegistration
from .sipgate.sms import send as send_sms from .sipgate.sms import send as send_sms
import sentry_sdk
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,20 +1,18 @@
import datetime from django.shortcuts import render, redirect, get_object_or_404
import math from .models import Shift, LoginToken, Helper, ShiftRegistration
from django.db import transaction
from django.db.models import F, Count, Q, ExpressionWrapper
from django.core.cache import cache
from .forms import RegisterForm, EmptyForm, AstaForm
from django.db.models.fields import DateTimeField
from datetime import timedelta from datetime import timedelta
from django.utils import timezone
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.core.cache import cache import datetime
from django.db import transaction
from django.db.models import Count, ExpressionWrapper, F, Q
from django.db.models.fields import DateTimeField
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
from dynamic_preferences.registries import global_preferences_registry
from .decorators import event_state from .decorators import event_state
from .forms import AstaForm, EmptyForm, RegisterForm from dynamic_preferences.registries import global_preferences_registry
from .models import Helper, LoginToken, Shift, ShiftRegistration import math
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,4 +1,4 @@
from .signals import populate_footer_nav, populate_nav from .signals import populate_nav
def nav(request): def nav(request):
@ -9,15 +9,6 @@ def nav(request):
for item in items for item in items
] ]
return {"nav_items": nav_items} return {
"nav_items": nav_items,
}
def footer_nav(request):
nav_items = [
item
for _, items in populate_footer_nav.send(sender=request)
if isinstance(items, list)
for item in items
]
return {"footer_nav_items": nav_items}

View File

@ -1,5 +1,3 @@
from django.dispatch import Signal from django.dispatch import Signal
populate_nav = Signal() populate_nav = Signal()
populate_footer_nav = Signal()

View File

@ -110,13 +110,9 @@
{% endblock %} {% endblock %}
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5"> <div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
<ul> <ul>
{% for item in footer_nav_items %} <li><a href="{% url 'pages:view' 'map' %}">Karte</a></li>
<li> <li><a href="{% url 'pages:view' 'faq' %}">Häufig gestellte Fragen</a></li>
<{% if item.link %}a{% else %}p{% endif %}{% if item.class %} class="{{ item.class }}"{% endif %}{% if item.link %} href="{{ item.link }}"{% endif %}> <li><a href="{% url 'pages:view' 'about' %}">Über diese Seite/Impressum</a></li>
{{ item.text }}
</{% if item.link %}a{% else %}p{% endif %}>
</li>
{% endfor %}
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -1,6 +1,5 @@
from django.contrib import admin from django.contrib import admin
from django.shortcuts import reverse from django.shortcuts import reverse
from .models import * from .models import *

View File

@ -1,7 +1,7 @@
# Generated by Django 4.0.4 on 2023-05-07 16:00 # Generated by Django 4.0.4 on 2023-05-07 16:00
import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,6 @@
# Generated by Django 4.0.4 on 2023-05-13 17:28 # Generated by Django 4.0.4 on 2023-05-13 17:28
from django.db import migrations, models from django.db import migrations, models
import shiftregister.fallback.models import shiftregister.fallback.models

View File

@ -1,12 +1,11 @@
from shiftregister.importer.models import *
from django.db.models import Max, Sum
from django.db.models import Count, Exists, OuterRef, ExpressionWrapper
from django.db.models.lookups import LessThan
from django.db.models.fields import DateTimeField
from base64 import urlsafe_b64encode
import math import math
import secrets import secrets
from base64 import urlsafe_b64encode
from django.db.models import Count, Exists, ExpressionWrapper, Max, OuterRef, Sum
from django.db.models.fields import DateTimeField
from django.db.models.lookups import LessThan
from shiftregister.importer.models import *
night_shift_query = Q(start_at__hour__gte=21) | Q(start_at__hour__lte=10) night_shift_query = Q(start_at__hour__gte=21) | Q(start_at__hour__lte=10)

View File

@ -1,15 +1,14 @@
from datetime import datetime
from celery import shared_task from celery import shared_task
from .models import FallbackAssignment
from shiftregister.app.models import ShiftRegistration
from django.conf import settings from django.conf import settings
from django.db import transaction from django.db import transaction
from django.db.models import Case, Count, ExpressionWrapper, F, Q, When
from django.utils import timezone from django.utils import timezone
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from django.db.models import F, Count, Q, ExpressionWrapper, Case, When
from datetime import datetime
from django.utils import timezone
from shiftregister.app.models import ShiftRegistration
from .models import FallbackAssignment
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,10 +1,8 @@
from base64 import urlsafe_b64decode from base64 import urlsafe_b64decode
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db.models import Count from django.db.models import Count
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render from django.shortcuts import render, get_object_or_404
from shiftregister.fallback.models import TeamMember from shiftregister.fallback.models import TeamMember
# Create your views here. # Create your views here.

View File

@ -1,7 +1,6 @@
from django import forms
from django.forms import ModelForm
from .models import Feedback from .models import Feedback
from django.forms import ModelForm
from django import forms
class FeedbackForm(ModelForm): class FeedbackForm(ModelForm):

View File

@ -1,7 +1,7 @@
# Generated by Django 4.0.4 on 2023-05-25 14:16 # Generated by Django 4.0.4 on 2023-05-25 14:16
import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,7 @@
# Generated by Django 4.0.4 on 2023-05-27 17:48 # Generated by Django 4.0.4 on 2023-05-27 17:48
import secrets
from django.db import migrations, models from django.db import migrations, models
import secrets
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,5 @@
from secrets import token_urlsafe
from django.db import models from django.db import models
from secrets import token_urlsafe
from shiftregister.app.models import Helper from shiftregister.app.models import Helper

View File

@ -1,7 +1,6 @@
from django.dispatch import receiver from django.dispatch import receiver
from django.shortcuts import reverse from django.shortcuts import reverse
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from shiftregister.core.signals import populate_nav from shiftregister.core.signals import populate_nav
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,11 +1,9 @@
from django.contrib import messages from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render
from shiftregister.app.models import LoginToken
from .forms import FeedbackForm from .forms import FeedbackForm
from .models import Feedback, ShareToken from .models import Feedback, ShareToken
from shiftregister.app.models import LoginToken
from django.contrib import messages
from django.contrib.auth.decorators import login_required
def feedback(request, token): def feedback(request, token):

View File

@ -1,5 +1,4 @@
from django.contrib import admin from django.contrib import admin
from .models import Calendar from .models import Calendar

View File

@ -1,11 +1,9 @@
from datetime import timezone from datetime import timezone
import requests
from django.conf import settings from django.conf import settings
from django.db import transaction from django.db import transaction
from icalendar import Calendar from icalendar import Calendar
from .models import Event, Room, Shift from .models import Event, Room, Shift
import requests
def import_calendar(calendar): def import_calendar(calendar):

View File

@ -1,7 +1,7 @@
# Generated by Django 4.0.4 on 2022-04-27 14:11 # Generated by Django 4.0.4 on 2022-04-27 14:11
import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,5 +1,4 @@
from django.db import models from django.db import models
from shiftregister.app.models import * from shiftregister.app.models import *

View File

@ -1,5 +1,4 @@
from celery import shared_task from celery import shared_task
from .importer import import_calendar from .importer import import_calendar
from .models import Calendar from .models import Calendar

View File

@ -1,8 +1,7 @@
from django.db import models from django.db import models
from django.db.models import Case, Count, F, Sum, When from django.db.models import Count, Case, F, When, Sum
from django.http import HttpResponse from django.http import HttpResponse
from shiftregister.app.models import Helper, Room, Shift, ShiftRegistration, Message
from shiftregister.app.models import Helper, Message, Room, Shift, ShiftRegistration
from shiftregister.fallback.models import FallbackAssignment from shiftregister.fallback.models import FallbackAssignment
from shiftregister.importer.models import Event from shiftregister.importer.models import Event
@ -160,11 +159,9 @@ def metrics(request):
), ),
( (
"worked_seconds_total", "worked_seconds_total",
( worked_seconds_total.total_seconds()
worked_seconds_total.total_seconds() if worked_seconds_total
if worked_seconds_total else 0.0,
else 0.0
),
), ),
( (
"worked_shifts_total", "worked_shifts_total",

View File

@ -1,8 +1,6 @@
from pathlib import Path
from django.contrib import admin from django.contrib import admin
from .models import Page from .models import Page
from pathlib import Path
def reimport(modeladmin, request, queryset): def reimport(modeladmin, request, queryset):
@ -15,21 +13,6 @@ def reimport(modeladmin, request, queryset):
@admin.register(Page) @admin.register(Page)
class PageAdmin(admin.ModelAdmin): class PageAdmin(admin.ModelAdmin):
fields = ( fields = ("url", "content", "title", "visible", "kind")
"url", list_display = ("url", "title", "visible", "kind")
"content",
"title",
"visible",
"kind",
"show_in_footer_nav",
"show_in_main_nav",
)
list_display = (
"url",
"title",
"visible",
"kind",
"show_in_footer_nav",
"show_in_main_nav",
)
actions = (reimport,) actions = (reimport,)

View File

@ -1,9 +1,7 @@
from django.apps import AppConfig from django.apps import AppConfig
from pathlib import Path
class PagesConfig(AppConfig): class PagesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField" default_auto_field = "django.db.models.BigAutoField"
name = "shiftregister.pages" name = "shiftregister.pages"
def ready(self):
from . import signals

View File

@ -1,9 +1,7 @@
from pathlib import Path
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from ...models import Page from ...models import Page
from pathlib import Path
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -1,23 +0,0 @@
# Generated by Django 5.0.4 on 2024-05-03 21:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pages", "0002_page_kind_alter_page_title"),
]
operations = [
migrations.AddField(
model_name="page",
name="show_in_footer_nav",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="page",
name="show_in_main_nav",
field=models.BooleanField(default=False),
),
]

View File

@ -16,8 +16,6 @@ class Page(models.Model):
visible = models.BooleanField(default=True) visible = models.BooleanField(default=True)
title = models.CharField(blank=True, max_length=200) title = models.CharField(blank=True, max_length=200)
kind = models.CharField(choices=KIND_CHOICES, default=REGULAR, max_length=8) kind = models.CharField(choices=KIND_CHOICES, default=REGULAR, max_length=8)
show_in_footer_nav = models.BooleanField(default=True)
show_in_main_nav = models.BooleanField(default=False)
def __str__(self): def __str__(self):
return ( return (

View File

@ -1,30 +0,0 @@
from django.dispatch import receiver
from django.urls import reverse
from shiftregister.core.signals import populate_footer_nav, populate_nav
from .models import Page
@receiver(populate_footer_nav, dispatch_uid="populate_pages_footer_nav")
def populate_pages_footer_nav(sender, **kwargs):
return [
{
"link": reverse("pages:view", args=(page.url,)),
"text": page.title or page.url,
}
for page in Page.objects.filter(visible=True)
if page.visible and page.show_in_footer_nav
]
@receiver(populate_nav, dispatch_uid="populate_pages_nav")
def populate_pages_nav(sender, **kwargs):
return [
{
"link": reverse("pages:view", args=(page.url,)),
"text": page.title or page.url,
}
for page in Page.objects.filter(visible=True)
if page.visible and page.show_in_main_nav
]

View File

@ -1,9 +1,8 @@
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from django.http import HttpResponseNotFound
from django.shortcuts import redirect
from django.views.generic import DetailView from django.views.generic import DetailView
from django.shortcuts import redirect
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponseNotFound
from .models import Page from .models import Page
# Create your views here. # Create your views here.

View File

@ -10,13 +10,12 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/ https://docs.djangoproject.com/en/4.0/ref/settings/
""" """
from os import getenv
from pathlib import Path from pathlib import Path
from os import getenv
import sentry_sdk import sentry_sdk
from django.contrib.messages import constants as messages
from sentry_sdk.integrations.celery import CeleryIntegration from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.django import DjangoIntegration
from django.contrib.messages import constants as messages
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -40,15 +39,15 @@ ALLOWED_HOSTS = list(filter(lambda s: s != "", getenv("ALLOWED_HOSTS", "").split
INSTALLED_APPS = [ INSTALLED_APPS = [
"dynamic_preferences", "dynamic_preferences",
"shiftregister.app", "shiftregister.app.apps.AppConfig",
"shiftregister.core", "shiftregister.core.apps.CoreConfig",
"shiftregister.fallback", "shiftregister.fallback.apps.FallbackConfig",
"shiftregister.importer", "shiftregister.importer.apps.ImporterConfig",
"shiftregister.metrics", "shiftregister.metrics.apps.MetricsConfig",
"shiftregister.pages", "shiftregister.pages.apps.PagesConfig",
"shiftregister.signage", "shiftregister.signage.apps.SignageConfig",
"shiftregister.team", "shiftregister.team.apps.TeamConfig",
"shiftregister.feedback", "shiftregister.feedback.apps.FeedbackConfig",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.auth", "django.contrib.auth",
"django.contrib.contenttypes", "django.contrib.contenttypes",
@ -86,7 +85,6 @@ TEMPLATES = [
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"shiftregister.app.context_processors.proc", "shiftregister.app.context_processors.proc",
"shiftregister.core.context_processors.footer_nav",
"shiftregister.core.context_processors.nav", "shiftregister.core.context_processors.nav",
], ],
}, },
@ -148,6 +146,10 @@ USE_TZ = True
STATIC_ROOT = "/opt/shiftregister/static" STATIC_ROOT = "/opt/shiftregister/static"
STATIC_URL = "static/" STATIC_URL = "static/"
STATICFILES_DIRS = [
BASE_DIR / "assets",
]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
@ -176,7 +178,7 @@ CELERY_BEAT_SCHEDULE = {
}, },
"deactivate-fallbacks-every-300-seconds": { "deactivate-fallbacks-every-300-seconds": {
"task": "shiftregister.fallback.tasks.deactivate_fallbacks", "task": "shiftregister.fallback.tasks.deactivate_fallbacks",
"schedule": float(getenv("FALLBACK_DEACTIVATE_INTERVAL", 300.0)), # seconds "schedule": float(getenv("FALLBACK_DEACTIVAtE_INTERVAL", 300.0)), # seconds
}, },
} }

View File

@ -1,7 +1,7 @@
# Generated by Django 4.0.4 on 2022-05-18 13:10 # Generated by Django 4.0.4 on 2022-05-18 13:10
import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,3 +1,2 @@
from django.db import models from django.db import models
from shiftregister.app.models import * from shiftregister.app.models import *

View File

@ -1,10 +1,8 @@
from datetime import timedelta from datetime import timedelta
from django.db import models from django.db import models
from django.db.models import Case, Count, ExpressionWrapper, F, Q, Sum, When from django.db.models import Case, Count, F, ExpressionWrapper, Q, Sum, When
from django.shortcuts import render from django.shortcuts import render
from django.utils import timezone from django.utils import timezone
from .models import Helper, Shift, ShiftRegistration from .models import Helper, Shift, ShiftRegistration

View File

@ -1,5 +1,4 @@
from django.contrib import admin from django.contrib import admin
from .models import IncomingMessage, RoomViewToken from .models import IncomingMessage, RoomViewToken
# Register your models here. # Register your models here.

View File

@ -1,6 +1,5 @@
from django import forms from django import forms
from .models import ShiftRegistration, Helper
from .models import Helper, ShiftRegistration
# placeholder form for simple submit button use cases so we get csrf protection # placeholder form for simple submit button use cases so we get csrf protection

View File

@ -1,7 +1,7 @@
# Generated by Django 4.0.4 on 2023-05-06 23:27 # Generated by Django 4.0.4 on 2023-05-06 23:27
import phonenumber_field.modelfields
from django.db import migrations, models from django.db import migrations, models
import phonenumber_field.modelfields
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,7 @@
# Generated by Django 4.0.4 on 2023-05-18 15:15 # Generated by Django 4.0.4 on 2023-05-18 15:15
import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
import shiftregister.team.models import shiftregister.team.models

View File

@ -1,9 +1,7 @@
import secrets
from django.db import models from django.db import models
from phonenumber_field.modelfields import PhoneNumberField from phonenumber_field.modelfields import PhoneNumberField
from shiftregister.app.models import * from shiftregister.app.models import *
import secrets
# Create your models here. # Create your models here.

View File

@ -1,9 +1,7 @@
from django.dispatch import receiver from django.dispatch import receiver
from django.shortcuts import reverse from django.shortcuts import reverse
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from shiftregister.core.signals import populate_nav from shiftregister.core.signals import populate_nav
from .models import IncomingMessage from .models import IncomingMessage
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()

View File

@ -1,10 +1,8 @@
import sentry_sdk
from celery import shared_task from celery import shared_task
from django.conf import settings from django.conf import settings
from shiftregister.app.sipgate.history import list_incoming_sms from shiftregister.app.sipgate.history import list_incoming_sms
from .models import IncomingMessage from .models import IncomingMessage
import sentry_sdk
@shared_task @shared_task

View File

@ -1,6 +1,5 @@
from re import ASCII, sub
from django import template from django import template
from re import ASCII, sub
register = template.Library() register = template.Library()

View File

@ -1,27 +1,26 @@
from datetime import timedelta from django.shortcuts import render, get_object_or_404, redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator
from django.db import models, transaction
from django.db.models import Case, Count, ExpressionWrapper, F, Q, When
from django.db.models.fields import DateTimeField
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone from django.utils import timezone
from django.db.models.fields import DateTimeField
from django.db.models import F, Count, Q, ExpressionWrapper, Case, When
from .models import (
ShiftRegistration,
Room,
Shift,
Helper,
Message,
IncomingMessage,
RoomViewToken,
)
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.db import models, transaction
from django.core.paginator import Paginator
from .forms import BulkMessage, HelperShift, HelperMessage
from datetime import timedelta
from .forms import BulkMessage, HelperMessage, HelperShift
from .models import (
Helper,
IncomingMessage,
Message,
Room,
RoomViewToken,
Shift,
ShiftRegistration,
)
# Create your views here. # Create your views here.

View File

@ -13,7 +13,6 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path