Browse Source

accounts now user editable in own table

master
Benni Baermann 3 weeks ago
parent
commit
6a2dc6f1c9
  1. 4
      input/admin.py
  2. 23
      input/migrations/0063_auto_20210708_0553.py
  3. 18
      input/migrations/0064_alter_accounts_code.py
  4. 17
      input/migrations/0065_rename_accounts_account.py
  5. 11
      input/models.py

4
input/admin.py

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

23
input/migrations/0063_auto_20210708_0553.py

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

18
input/migrations/0064_alter_accounts_code.py

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

17
input/migrations/0065_rename_accounts_account.py

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

11
input/models.py

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

Loading…
Cancel
Save