fixed TypeError for django 3.2

This commit is contained in:
Benni Bärmann 2021-07-06 13:00:34 +02:00
parent d442e3b3f6
commit 94164c3d6a
4 changed files with 41 additions and 9 deletions

10
TODO
View File

@ -20,10 +20,8 @@ other known problems:
- we should add dates to the outputs, to make it more useful in logfiles - we should add dates to the outputs, to make it more useful in logfiles
known problems in production: - maybe change logo in browser dark mode to https://upload.wikimedia.org/wikipedia/commons/2/2a/Wmde_logo_vert_weiss.png
- works only with django == 3.1.x - warning from django 3.2:
input.BusinessCard: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
- reboot of container should be far more automated HINT: Configure the DEFAULT_AUTO_FIELD setting or the InputConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
- puppet should provide the git source, and secrets.json and settings.py link

View File

@ -3,7 +3,7 @@ from django.forms import ModelForm, DateField, ChoiceField, RadioSelect, Boolean
from django.contrib.admin.widgets import AdminDateWidget from django.contrib.admin.widgets import AdminDateWidget
from django.utils.html import format_html from django.utils.html import format_html
from .models import Project, Volunteer, Extern, IFG, Library, TYPE_CHOICES,\ from .models import Project, Volunteer, Extern, ConcreteExtern, IFG, Library, TYPE_CHOICES,\
HonoraryCertificate, Travel, Email, Literature, List,\ HonoraryCertificate, Travel, Email, Literature, List,\
BusinessCard BusinessCard
from .settings import DATAPROTECTION, FOERDERRICHTLINIEN, NUTZUNGSBEDINGUNGEN from .settings import DATAPROTECTION, FOERDERRICHTLINIEN, NUTZUNGSBEDINGUNGEN
@ -36,7 +36,7 @@ class ExternForm(FdbForm):
DATAPROTECTION, FOERDERRICHTLINIEN)) DATAPROTECTION, FOERDERRICHTLINIEN))
class Meta: class Meta:
model = Extern model = ConcreteExtern
exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date') exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date')
INTERN_CHOICES = {'PRO': 'Projektsteckbrief', INTERN_CHOICES = {'PRO': 'Projektsteckbrief',

View File

@ -0,0 +1,30 @@
# Generated by Django 3.2.5 on 2021-07-06 10:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0059_auto_20210412_1142'),
]
operations = [
migrations.CreateModel(
name='ConcreteExtern',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('realname', models.CharField(help_text='Bitte gib deinen Vornamen und deinen Nachnamen ein.', max_length=200, null=True, verbose_name='Realname')),
('email', models.EmailField(help_text='Bitte gib deine E-Mail-Adresse ein, damit dich<br>Wikimedia Deutschland bei Rückfragen oder für<br>die Zusage kontaktieren kann.', max_length=200, null=True, verbose_name='E-Mail-Adresse')),
('granted', models.BooleanField(null=True)),
('granted_date', models.DateField(null=True)),
('survey_mail_send', models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken')),
('survey_mail_date', models.DateField(blank=True, null=True, verbose_name='Umfragemail wurde verschickt am')),
('username', models.CharField(help_text='Bitte gib den Namen ein, mit dem du dich<br>in den Wikimedia-Projekten registriert hast.', max_length=200, null=True, verbose_name='Benutzer_innenname')),
('service_id', models.CharField(blank=True, max_length=15, null=True)),
],
options={
'abstract': False,
},
),
]

View File

@ -17,7 +17,7 @@ class Volunteer(models.Model):
granted_date = models.DateField(null=True) granted_date = models.DateField(null=True)
survey_mail_send = models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken') survey_mail_send = models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken')
survey_mail_date = models.DateField(verbose_name='Umfragemail wurde verschickt am', null=True, blank=True) survey_mail_date = models.DateField(verbose_name='Umfragemail wurde verschickt am', null=True, blank=True)
@classmethod @classmethod
def set_granted(cl, key, b): def set_granted(cl, key, b):
obj = cl.objects.get(pk=key) obj = cl.objects.get(pk=key)
@ -46,6 +46,10 @@ class Extern(Volunteer):
class Meta: class Meta:
abstract = True abstract = True
class ConcreteExtern(Extern):
''' needed because we can't initiate abstract base classes in the view'''
pass
class Project(Volunteer): class Project(Volunteer):
name = models.CharField(max_length=200, verbose_name='Name des Projekts') name = models.CharField(max_length=200, verbose_name='Name des Projekts')
description = models.CharField(max_length=500, verbose_name="Kurzbeschreibung", null=True) description = models.CharField(max_length=500, verbose_name="Kurzbeschreibung", null=True)