Skip to content

Commit

Permalink
fix admin page, set update_version if update_cdef has value
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Mar 4, 2024
1 parent 002c197 commit fbfe767
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 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 %}
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 fbfe767

Please sign in to comment.