Skip to content

Commit

Permalink
Merge branch 'release/0.3.74' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Mar 4, 2024
2 parents aaaa2e4 + fbfe767 commit 8f95021
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 30 deletions.
2 changes: 2 additions & 0 deletions edc_consent/consent_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __post_init__(self):
self.update_cdef, self.update_model = self.updates
except (ValueError, TypeError):
pass
else:
self.update_version = self.update_cdef.version
if not self.screening_model:
self.screening_model = get_subject_screening_model()
if MALE not in self.gender and FEMALE not in self.gender:
Expand Down
37 changes: 13 additions & 24 deletions edc_consent/templates/edc_consent/bootstrap3/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,36 @@
{% block main %}
<div class="container">

<div id="div-home-right" class="col-md-8">
<div id="div-home-right" class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Consent Versions</div>
<table class="table table-hover responsive">
<thead>
<tr>
<th>Model</th>
<th>Version</th>
<th>Start Date</th>
<th>End Date</th>
<th>Start</th>
<th>End</th>
<th>Updates</th>
<th>Updates using model</th>
</tr>
</thead>
<tbody>
{% for consent in consents %}
<tr>
<td>{{consent.verbose_name|title}}</td>
<td>{{consent.version}}</td>
<td>{{consent.start_datetime|date:"Y-M-d"}}</td>
<td>{{consent.start_datetime|date:"Y-M-d"}}</td>
<td>{{consent.update_model}}</td>
</tr>
{% for cdef in consent_definitions %}
<tr>
<td>{{cdef.verbose_name|title}}</td>
<td>{{cdef.version}}</td>
<td>{{cdef.start|date:"d-m-Y"}}</td>
<td>{{cdef.end|date:"d-m-Y"}}</td>
<td>{{cdef.update_version|default:"-"}}</td>
<td>{{cdef.update_model|default:"-"}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="panel panel-default">
<div class="panel-heading">Consent Verification</div>
</div>
</div>
<div id="div-home-right" class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">Administration</div>
<ul class="nav nav-pills nav-stacked">
<li><a href="{% url 'edc_consent:edc_consent_admin:index' %}">Admin Site</a></li>
{% for consent in consents %}
<li><a href="">{{ consent.name }}</a></li>
{% endfor %}
</ul>
</div>
</div>

</div>
{% endblock main %}
12 changes: 7 additions & 5 deletions edc_consent/view_mixins/consent_view_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ def consents(self) -> QuerySet[ConsentLikeModel]:
if not self._consents:
self._consents = []
for cdef in site_consents.get_consent_definitions():
if obj := cdef.get_consent_for(
subject_identifier=self.subject_identifier,
raise_if_not_consented=False,
):
self._consents.append(obj)
try:
obj = cdef.get_consent_for(subject_identifier=self.subject_identifier)
except NotConsentedError:
pass
else:
if obj not in self._consents:
self._consents.append(obj)
return self._consents

@property
Expand Down
2 changes: 1 addition & 1 deletion edc_consent/views/home_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def __init__(self, *args, **kwargs):
def get_context_data(self, **kwargs) -> dict[str, Any]:
kwargs.update(
edc_consent_admin=edc_consent_admin,
consents=site_consents.consent_definitions,
consent_definitions=site_consents.get_consent_definitions,
)
return super().get_context_data(**kwargs)

0 comments on commit 8f95021

Please sign in to comment.