first steps to editable accounts

This commit is contained in:
Benni Bärmann 2021-07-07 15:16:39 +02:00
parent a23ffdf67f
commit cdb27e6b89
5 changed files with 37 additions and 4 deletions

2
TODO
View File

@ -2,7 +2,7 @@ known bugs:
- there is html-code in some plain text mails, because they use
models.TYPE_CHOICES, which is in html, because it is mainly used for the
website side of things.
webside side of things.
- helptext by /intern email: "Bitte gib deine E-Mail-Adresse ein, damit dich
Wikimedia Deutschland bei Rückfragen oder für

View File

@ -3,7 +3,7 @@ import csv
from django.contrib import admin
from django.http import HttpResponse
from .models import Project, HonoraryCertificate, Library, IFG, Travel,\
from .models import Accounts, Project, HonoraryCertificate, Library, IFG, Travel,\
Email, BusinessCard, List, Literature
@ -35,6 +35,7 @@ class ProjectAdmin(admin.ModelAdmin):
admin.site.register([
Accounts,
HonoraryCertificate,
Library,
IFG,

View File

@ -0,0 +1,25 @@
# Generated by Django 3.2.5 on 2021-07-07 13:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('input', '0061_concretevolunteer'),
]
operations = [
migrations.CreateModel(
name='Accounts',
fields=[
('acc', models.CharField(choices=[('DEF', 'DEFAULT VALUE, you hould not see this!'), ('21111', '21111 Förderung (reaktiv)'), ('21112', '21112 WikiCon'), ('21115', '21115 Lokale Räume, Berlin'), ('21116', '21116 Lokale Räume, Hamburg'), ('21117', '21117 Lokale Räume, Hannover'), ('21118', '21118 Lokale Räume, Köln'), ('21119', '21119 Lokale Räume, München'), ('21120', '21120 Lokale Räume, Fürth'), ('21125', '21125 Lokale Räume, allgemein'), ('21130', '21130 GLAM-Förderung'), ('21131', '21131 Initiative Förderung'), ('21140', '21140 Wikipedia-Kampagne'), ('21141', '21141 Wikipedia-Onboarding'), ('21150', '21150 Fürsorge und Online-Kommunikationskultur')], default='DEF', max_length=5, primary_key=True, serialize=False, verbose_name='Kostenstelle')),
],
),
migrations.AlterField(
model_name='project',
name='account',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='input.accounts'),
),
]

View File

@ -50,6 +50,13 @@ class ConcreteExtern(Extern):
''' needed because we can't initiate abstract base classes in the view'''
pass
class Accounts(models.Model):
acc = models.CharField('Kostenstelle', max_length=5, default="DEF",
choices=ACCOUNTS.items(), null=False, primary_key = True)
def __str__(self):
return f"{ACCOUNTS[self.acc]}"
class Project(Volunteer):
name = models.CharField(max_length=200, verbose_name='Name des Projekts')
description = models.CharField(max_length=500, verbose_name="Kurzbeschreibung", null=True)
@ -67,8 +74,7 @@ class Project(Volunteer):
insurance_technic = models.BooleanField(default=False, verbose_name='Technikversicherung Ausland')
support = models.CharField(max_length=300, blank=True, null=True, verbose_name='Betreuungsperson und Vertretung')
cost = models.IntegerField(blank=True, null=True)
account = models.CharField('Kostenstelle', max_length=5,
choices=ACCOUNTS.items(), null=True,)
account = models.ForeignKey('Accounts', on_delete=models.CASCADE, null=True, to_field='acc')
granted_from = models.CharField(max_length=100,null=True,verbose_name='Bewilligt von')
notes = models.CharField(max_length=1000,null=True,blank=True,verbose_name='Anmerkungen')

View File

@ -12,6 +12,7 @@ NUTZUNGSBEDINGUNGEN = 'static/input/nutzungsbedingungen.html'
ACCOUNTS ={ # "21103": '21103 Willkommen',
"DEF": 'DEFAULT VALUE, you hould not see this!',
"21111": '21111 Förderung (reaktiv)',
"21112": '21112 WikiCon',
# "21113": '21113 Wikimania/Unterstützung Ehrenamtliche',