Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds previous credential applications to admin user profile #1260

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{% load console_templatetags %}

<p>Username: <a href="{% url 'user_management' application.user.username %}">{{ application.user.username }}</a></br>
Applied: {{ application.application_datetime|date }}</p>
Applied: {{ application.application_datetime|date }}</br>
[<a href="{% url 'user_credential_applications' application.user %}" target="_blank">View previous applications.</a>]</br>
[<a href="https://www.google.com/search?q={{ application.first_names }} {{ application.last_name }} {{ application.organization_name }}" target="_blank">Search for name and affiliation.</a>]</p>

{% if application.reference_contact_datetime %}
Reference contact date: {{ application.reference_contact_datetime|date }}<br />
Expand Down
1 change: 0 additions & 1 deletion physionet-django/console/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ def user_management(request, username):
projects['Archived'] = ArchivedProject.objects.filter(authors__user=user).order_by('-archive_datetime')
projects['Published'] = PublishedProject.objects.filter(authors__user=user).order_by('-publish_datetime')


return render(request, 'console/user_management.html', {'subject': user,
'profile': user.profile,
'emails': emails,
Expand Down
2 changes: 2 additions & 0 deletions physionet-django/user/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
path('settings/credentialing/', views.edit_credentialing, name='edit_credentialing'),
path('settings/credentialing/applications/',
views.user_credential_applications, name='user_credential_applications'),
path('settings/credentialing/applications/<username>/',
views.user_credential_applications, name='user_credential_applications'),
path('settings/agreements/', views.view_agreements, name='edit_agreements'),
path('settings/agreements/<id>/',
views.view_signed_agreement, name='view_signed_agreement'),
Expand Down
13 changes: 10 additions & 3 deletions physionet-django/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from django.db import IntegrityError
from django.forms import inlineformset_factory, HiddenInput, CheckboxInput
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import redirect, render
from django.shortcuts import redirect, render, get_object_or_404
from django.template import loader
from django.urls import reverse, reverse_lazy
from django.utils import timezone
Expand Down Expand Up @@ -576,12 +576,19 @@ def edit_credentialing(request):


@login_required
def user_credential_applications(request):
def user_credential_applications(request, username=None):
"""
All the credential applications made by a user
"""
if username:
if request.user.is_admin or (request.user == username):
request_user = get_object_or_404(User, username__iexact=username)
else:
raise Http404()
else:
request_user = request.user
applications = CredentialApplication.objects.filter(
user=request.user).order_by('-application_datetime')
user=request_user).order_by('-application_datetime')

return render(request, 'user/user_credential_applications.html',
{'applications':applications})
Expand Down