#20 Multiple laws
* refactors law field from ForeignKey to ManyToManyField to support multiple laws being added to one LegalData object * added funding data to EMA detail view
This commit is contained in:
parent
43075088de
commit
8a2bbb1fc2
@ -50,6 +50,19 @@
|
|||||||
<th scope="row">{% trans 'Intervention handler' %}</th>
|
<th scope="row">{% trans 'Intervention handler' %}</th>
|
||||||
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
<td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Funded by' %}</th>
|
||||||
|
<td class="align-middle">
|
||||||
|
{% for funding in obj.fundings.all %}
|
||||||
|
<div class="badge badge-pill rlp-r-outline">
|
||||||
|
{{ funding.short_name}}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
{% empty %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Last modified' %}</th>
|
<th scope="row">{% trans 'Last modified' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
|
@ -31,7 +31,6 @@ class LegalAdmin(admin.ModelAdmin):
|
|||||||
list_display = [
|
list_display = [
|
||||||
"id",
|
"id",
|
||||||
"process_type",
|
"process_type",
|
||||||
"law",
|
|
||||||
"registration_date",
|
"registration_date",
|
||||||
"binding_date",
|
"binding_date",
|
||||||
]
|
]
|
||||||
|
@ -136,6 +136,7 @@ class RevocationDocument(AbstractDocument):
|
|||||||
# Folder seems to be missing already
|
# Folder seems to be missing already
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LegalData(UuidModel):
|
class LegalData(UuidModel):
|
||||||
"""
|
"""
|
||||||
Holds intervention legal data such as important dates, laws or responsible handler
|
Holds intervention legal data such as important dates, laws or responsible handler
|
||||||
@ -158,11 +159,9 @@ class LegalData(UuidModel):
|
|||||||
"is_archived": False,
|
"is_archived": False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
law = models.ForeignKey(
|
laws = models.ManyToManyField(
|
||||||
KonovaCode,
|
KonovaCode,
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
null=True,
|
null=True,
|
||||||
related_name="+",
|
|
||||||
blank=True,
|
blank=True,
|
||||||
limit_choices_to={
|
limit_choices_to={
|
||||||
"code_lists__in": [CODELIST_LAW_ID],
|
"code_lists__in": [CODELIST_LAW_ID],
|
||||||
@ -173,13 +172,6 @@ class LegalData(UuidModel):
|
|||||||
|
|
||||||
revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
|
revocation = models.OneToOneField(Revocation, null=True, blank=True, help_text="Refers to 'Widerspruch am'", on_delete=models.SET_NULL)
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return "{} | {} | {}".format(
|
|
||||||
self.process_type,
|
|
||||||
self.law,
|
|
||||||
self.id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Intervention(BaseObject):
|
class Intervention(BaseObject):
|
||||||
"""
|
"""
|
||||||
|
@ -34,9 +34,14 @@
|
|||||||
<th scope="row">{% trans 'Process type' %}</th>
|
<th scope="row">{% trans 'Process type' %}</th>
|
||||||
<td class="align-middle">{{intervention.legal.process_type|default_if_none:""}}</td>
|
<td class="align-middle">{{intervention.legal.process_type|default_if_none:""}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr {% if not intervention.legal.law %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
|
<tr {% if intervention.legal.laws.count == 0 %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
|
||||||
<th scope="row">{% trans 'Law' %}</th>
|
<th scope="row">{% trans 'Law' %}</th>
|
||||||
<td class="align-middle">{{intervention.legal.law|default_if_none:""}}</td>
|
<td class="align-middle">
|
||||||
|
{% for law in intervention.legal.laws.all %}
|
||||||
|
<div class="badge pill-badge rlp-r-outline">{{law.short_name}} - {{law.long_name}}</div>
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr {% if not intervention.responsible.registration_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
|
<tr {% if not intervention.responsible.registration_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
|
||||||
<th scope="row">{% trans 'Registration office' %}</th>
|
<th scope="row">{% trans 'Registration office' %}</th>
|
||||||
|
Loading…
Reference in New Issue
Block a user