#39 Drop fundings
* removes fundings from all models, except the EMA model for migration compatibility (some old data may have fundings data)
This commit is contained in:
24
ema/forms.py
24
ema/forms.py
@@ -5,10 +5,15 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 06.10.21
|
||||
|
||||
"""
|
||||
from dal import autocomplete
|
||||
from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import transaction
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_COMPENSATION_FUNDING_ID
|
||||
from compensation.forms.forms import AbstractCompensationForm, CompensationResponsibleFormMixin
|
||||
from ema.models import Ema
|
||||
from intervention.models import ResponsibilityData
|
||||
@@ -23,6 +28,25 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
Second holds self.instance.response related fields
|
||||
|
||||
"""
|
||||
|
||||
fundings = forms.ModelMultipleChoiceField(
|
||||
label=_("Fundings"),
|
||||
label_suffix="",
|
||||
required=False,
|
||||
help_text=_("Select fundings for this compensation"),
|
||||
queryset=KonovaCode.objects.filter(
|
||||
is_archived=False,
|
||||
is_leaf=True,
|
||||
code_lists__in=[CODELIST_COMPENSATION_FUNDING_ID],
|
||||
),
|
||||
widget=autocomplete.ModelSelect2Multiple(
|
||||
url="codes-compensation-funding-autocomplete",
|
||||
attrs={
|
||||
"data-placeholder": _("Click for selection"),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
field_order = [
|
||||
"identifier",
|
||||
"title",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import shutil
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.db.models import QuerySet
|
||||
|
||||
from codelist.models import KonovaCode
|
||||
from codelist.settings import CODELIST_COMPENSATION_FUNDING_ID
|
||||
from compensation.models import AbstractCompensation
|
||||
from ema.managers import EmaManager
|
||||
from ema.utils.quality import EmaQualityChecker
|
||||
@@ -27,6 +28,16 @@ class Ema(AbstractCompensation, ShareableObject, RecordableObject):
|
||||
EMA therefore holds data like a compensation: actions, before-/after-states, deadlines, ...
|
||||
|
||||
"""
|
||||
fundings = models.ManyToManyField(
|
||||
KonovaCode,
|
||||
blank=True,
|
||||
limit_choices_to={
|
||||
"code_lists__in": [CODELIST_COMPENSATION_FUNDING_ID],
|
||||
"is_selectable": True,
|
||||
"is_archived": False,
|
||||
},
|
||||
help_text="List of funding project codes",
|
||||
)
|
||||
objects = EmaManager()
|
||||
|
||||
def __str__(self):
|
||||
|
||||
Reference in New Issue
Block a user