2
1
Fork 0

accounts now user editable in own table

Dieser Commit ist enthalten in:
Benni Bärmann 2021-07-08 08:00:28 +02:00
Ursprung cdb27e6b89
Commit 6a2dc6f1c9
5 geänderte Dateien mit 66 neuen und 7 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -0,0 +1,23 @@
# Generated by Django 3.2.5 on 2021-07-08 05:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0062_auto_20210707_1314'),
]
operations = [
migrations.RenameField(
model_name='accounts',
old_name='acc',
new_name='code',
),
migrations.AddField(
model_name='accounts',
name='description',
field=models.CharField(default='NO DESCRIPTION', max_length=30, verbose_name='Beschreibung'),
),
]

Datei anzeigen

@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-07-08 05:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0063_auto_20210708_0553'),
]
operations = [
migrations.AlterField(
model_name='accounts',
name='code',
field=models.CharField(default='DEF', max_length=5, primary_key=True, serialize=False, verbose_name='Kostenstelle'),
),
]

Datei anzeigen

@ -0,0 +1,17 @@
# Generated by Django 3.2.5 on 2021-07-08 05:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('input', '0064_alter_accounts_code'),
]
operations = [
migrations.RenameModel(
old_name='Accounts',
new_name='Account',
),
]

Datei anzeigen

@ -50,12 +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)
class Account(models.Model):
code = models.CharField('Kostenstelle', max_length=5, default="DEF",
null=False, primary_key = True)
description = models.CharField('Beschreibung', max_length=30, default='NO DESCRIPTION')
def __str__(self):
return f"{ACCOUNTS[self.acc]}"
return f"{self.code} {self.description}"
class Project(Volunteer):
name = models.CharField(max_length=200, verbose_name='Name des Projekts')
@ -74,7 +75,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.ForeignKey('Accounts', on_delete=models.CASCADE, null=True, to_field='acc')
account = models.ForeignKey('Account', on_delete=models.CASCADE, null=True, to_field='code')
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')