Browse Source

first steps to editable accounts

master
Benni Baermann 3 weeks ago
parent
commit
cdb27e6b89
  1. 2
      TODO
  2. 3
      input/admin.py
  3. 25
      input/migrations/0062_auto_20210707_1314.py
  4. 10
      input/models.py
  5. 1
      input/settings.py

2
TODO

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

3
input/admin.py

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

25
input/migrations/0062_auto_20210707_1314.py

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

10
input/models.py

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

1
input/settings.py

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

Loading…
Cancel
Save