2
0
Fork 0

Set LOGIN_URL globally

This commit is contained in:
Luca 2022-04-29 02:25:00 +02:00
parent 91922bb5d4
commit afce72c427
4 changed files with 12 additions and 6 deletions

View File

@ -29,7 +29,7 @@ class RegisterForm(forms.Form):
phone = PhoneNumberField(
max_length=Helper.phone.field.max_length,
label="Handynummer für Benachrichtigungen",
help_text="Wir nutzen deine Handynummer, um dir Benachrichtigungen zu deinen Schichten zu schicken. Wir löschen alle Daten 7 Tage nach dem Festival.",
help_text="Wir nutzen deine Handynummer, um dir Benachrichtigungen zu Schichten zu schicken. Wir löschen deine Daten 7 Tage nach dem Festival.",
widget=text_input(),
validators=[
validate_international_phonenumber,

View File

@ -8,13 +8,19 @@ from .sipgate.sms import send as send_sms
global_preferences = global_preferences_registry.manager()
def send(msg):
if not (settings.SIPGATE_SMS_EXTENSION and settings.SIPGATE_TOKEN and settings.SIPGATE_TOKEN_ID):
if not (
settings.SIPGATE_SMS_EXTENSION
and settings.SIPGATE_TOKEN
and settings.SIPGATE_TOKEN_ID
):
print(f"would send message to {msg.to.phone}\n---\n{msg.text}")
return
send_sms(msg.to.phone, msg.text)
# cron task to send normal messages(reminders,changes) in batches
@shared_task
def send_messages():

View File

@ -65,6 +65,8 @@ MIDDLEWARE = [
ROOT_URLCONF = "shiftregister.urls"
LOGIN_URL = "/admin/login/"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",

View File

@ -14,7 +14,7 @@ def index(request):
pass
@login_required(login_url="/admin/login/")
@login_required
def shift_overview(request):
context = {}
context["running_shifts"] = [
@ -44,7 +44,7 @@ def add_helper_shift(self):
pass
@login_required(login_url="/admin/login/")
@login_required
def shift_detail(request, pk):
shift = get_object_or_404(Shift, pk=pk)
form = HelperShift()
@ -75,13 +75,11 @@ def shift_detail(request, pk):
class HelperDetail(LoginRequiredMixin, DetailView):
login_url = "/admin/login/"
template_name = "helper_detail.html"
model = Helper
class ShiftList(LoginRequiredMixin, ListView):
login_url = "/admin/login/"
template_name = "shift_list.html"
model = Shift
title = "Alle Schichten"