Set LOGIN_URL globally

pull/1/head
Luca 3 years ago
parent 91922bb5d4
commit afce72c427

@ -29,7 +29,7 @@ class RegisterForm(forms.Form):
phone = PhoneNumberField( phone = PhoneNumberField(
max_length=Helper.phone.field.max_length, max_length=Helper.phone.field.max_length,
label="Handynummer für Benachrichtigungen", 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(), widget=text_input(),
validators=[ validators=[
validate_international_phonenumber, validate_international_phonenumber,

@ -8,13 +8,19 @@ from .sipgate.sms import send as send_sms
global_preferences = global_preferences_registry.manager() global_preferences = global_preferences_registry.manager()
def send(msg): 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}") print(f"would send message to {msg.to.phone}\n---\n{msg.text}")
return return
send_sms(msg.to.phone, msg.text) send_sms(msg.to.phone, msg.text)
# cron task to send normal messages(reminders,changes) in batches # cron task to send normal messages(reminders,changes) in batches
@shared_task @shared_task
def send_messages(): def send_messages():

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

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

Loading…
Cancel
Save