delete instance if DEBUG=False

This commit is contained in:
Benni Bärmann 2021-02-09 10:48:07 +01:00
parent 4dbb57ce42
commit e3de93366a
4 changed files with 34 additions and 6 deletions

View File

@ -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

View File

@ -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),
),
]

View File

@ -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")

View File

@ -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')