From e3de93366a29b536aa0d7785be5b8aaa9a467a15 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 9 Feb 2021 10:48:07 +0100 Subject: [PATCH] delete instance if DEBUG=False --- eva/settings.py | 4 ++-- evapp/migrations/0006_auto_20210209_0939.py | 24 +++++++++++++++++++++ evapp/models.py | 7 +++--- evapp/views.py | 5 +++++ 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 evapp/migrations/0006_auto_20210209_0939.py diff --git a/eva/settings.py b/eva/settings.py index a780bde..3b869b3 100644 --- a/eva/settings.py +++ b/eva/settings.py @@ -25,11 +25,11 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False STATIC_ROOT = BASE_DIR / 'staticfiles' -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition diff --git a/evapp/migrations/0006_auto_20210209_0939.py b/evapp/migrations/0006_auto_20210209_0939.py new file mode 100644 index 0000000..b67fc93 --- /dev/null +++ b/evapp/migrations/0006_auto_20210209_0939.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.4 on 2021-02-09 09:39 + +from django.db import migrations, models +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0005_employee_vendor'), + ] + + operations = [ + migrations.AddField( + model_name='employee', + name='rebu2go', + field=models.BooleanField(default=False, verbose_name='Rebu2Go-Zugang benötigt?'), + ), + migrations.AlterField( + model_name='employee', + name='accounts', + field=multiselectfield.db.fields.MultiSelectField(choices=[('OTRSWMDE', 'OTRS Ticketsystem'), ('CIVIC1', 'Civic CRM (allgemein)'), ('CIVIC2', 'Civic CRM (Mailings, impliziert allgemein)'), ('ZEDA', 'Zeda Nextcloud'), ('WEB', 'www.wikimedia.de (edit)'), ('BLOG', 'blog.wikimedia.de (edit)'), ('FORUM', 'forum.wikimedia.de')], max_length=42, null=True), + ), + ] diff --git a/evapp/models.py b/evapp/models.py index 664c92e..626d08c 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -28,11 +28,10 @@ MOBILE_CHOICES = {'NO': 'Kein Mobiltelefon', LANG_CHOICES = {'GER': 'deutsch', 'ENG': 'english',} -ACCOUNT_CHOICES = {'OTRSWMDE': 'OTRS (WMDE)', - 'OTRSFUND': 'OTRS (Fundraising)', +ACCOUNT_CHOICES = {'OTRSWMDE': 'OTRS Ticketsystem', 'CIVIC1': 'Civic CRM (allgemein)', 'CIVIC2': "Civic CRM (Mailings, impliziert allgemein)", - 'FUND': "Fundraising Netzlaufwerk", + 'ZEDA': "Zeda Nextcloud", 'WEB': 'www.wikimedia.de (edit)', 'BLOG': 'blog.wikimedia.de (edit)', 'FORUM': 'forum.wikimedia.de', @@ -49,7 +48,7 @@ class Employee(models.Model): intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True) email = models.CharField(max_length=50, verbose_name="E-Mail-Adresse") department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items()) - team = models.CharField(max_length=20, null=True, blank=True) + team = models.CharField(max_length=20, null=True, blank=True) # TODO? choices? # general work related stuff firstdate_employment = models.DateField(null=True, verbose_name="erster Arbeitstag") diff --git a/evapp/views.py b/evapp/views.py index 8e4dbc6..9e26342 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -8,6 +8,7 @@ from django.core.mail import send_mail, BadHeaderError from django.template.loader import get_template from formtools.wizard.views import CookieWizardView from django.shortcuts import render +from django.conf import settings from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VENDOR_CHOICES, \ MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES @@ -101,6 +102,10 @@ class EvaFormView(CookieWizardView): # send data to departments for dep in MAILS: self.send_mail_to_department(dep) + + if not settings.DEBUG: + self.instance.delete() + return HttpResponseRedirect('success')