forked from beba/foerderbarometer
allow empty grant fields in project
This commit is contained in:
parent
6a36b293f4
commit
c5bdc80c54
|
|
@ -86,6 +86,19 @@ class ProjectAdminForm(BaseProjectForm):
|
||||||
if self.initial[f'{field}_other']:
|
if self.initial[f'{field}_other']:
|
||||||
self.initial[field] = [*self.initial[field], model.other]
|
self.initial[field] = [*self.initial[field], model.other]
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
cleaned_data = BaseProjectForm.clean(self)
|
||||||
|
|
||||||
|
if self.errors:
|
||||||
|
return cleaned_data
|
||||||
|
|
||||||
|
if cleaned_data['granted']:
|
||||||
|
for field in 'granted_date', 'granted_from', 'account':
|
||||||
|
if not cleaned_data[field]:
|
||||||
|
self.add_error(field, 'Dieses Feld ist erforderlich, um dieses Projekt zu bewilligen.')
|
||||||
|
|
||||||
|
return cleaned_data
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Project)
|
@admin.register(Project)
|
||||||
class ProjectAdmin(admin.ModelAdmin):
|
class ProjectAdmin(admin.ModelAdmin):
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 5.2.5 on 2025-10-16 14:39
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('input', '0103_add_request_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='project',
|
||||||
|
name='account',
|
||||||
|
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=models.CASCADE, to='input.account'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='project',
|
||||||
|
name='granted_date',
|
||||||
|
field=models.DateField(blank=True, null=True, verbose_name='Bewilligt am'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='project',
|
||||||
|
name='granted_from',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Bewilligt von'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -219,8 +219,9 @@ class Project(Volunteer):
|
||||||
insurance_technic = models.BooleanField(default=False, verbose_name='Technikversicherung Ausland')
|
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')
|
support = models.CharField(max_length=300, blank=True, null=True, verbose_name='Betreuungsperson und Vertretung')
|
||||||
cost = models.IntegerField(blank=True, null=True, verbose_name='Kosten')
|
cost = models.IntegerField(blank=True, null=True, verbose_name='Kosten')
|
||||||
account = models.ForeignKey('Account', on_delete=models.CASCADE, null=True, to_field='code', db_constraint=False)
|
account = models.ForeignKey('Account', on_delete=models.CASCADE, blank=True, null=True, to_field='code', db_constraint=False)
|
||||||
granted_from = models.CharField(max_length=100, null=True, verbose_name='Bewilligt von')
|
granted_date = models.DateField(blank=True, null=True, verbose_name='Bewilligt am')
|
||||||
|
granted_from = models.CharField(max_length=100, blank=True, null=True, verbose_name='Bewilligt von')
|
||||||
notes = models.TextField(max_length=1000, null=True, blank=True, verbose_name='Anmerkungen')
|
notes = models.TextField(max_length=1000, null=True, blank=True, verbose_name='Anmerkungen')
|
||||||
intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen')
|
intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue