Show domain applications on home

This commit is contained in:
Seamus Johnston 2022-11-17 09:50:56 -06:00
parent f5c117df9f
commit b92fe3f469
No known key found for this signature in database
GPG key ID: 2F21225985069105
2 changed files with 37 additions and 3 deletions

View file

@ -17,9 +17,37 @@
<p>This is the .gov registrar.</p> <p>This is the .gov registrar.</p>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<p><a href="/openid/logout/">Click here to log out.</a></p>
{% if domain_applications %}
<h2>Your domain applications</h2>
<table class="usa-table usa-table--borderless">
<caption class="sr-only">Your domain applications</caption>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for application in domain_applications %}
<tr>
<th>{{ application.requested_domain.website }}</th>
<td>{{ application.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<p><a href="{% url 'application' %}" class="usa-button">Apply</a></p>
<p><a href="{% url 'edit-profile' %}">Edit profile</a></p>
<p><a href="{% url 'admin:index' %}">CISA admin panel</a></p>
<p><a href="{% url 'logout' %}">Click here to log out.</a></p>
{% else %} {% else %}
<p><a href="/openid/login/">Click here to log in.</a></p> <p><a href="{% url 'login' %}">Click here to log in.</a></p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,6 +1,12 @@
from django.shortcuts import render from django.shortcuts import render
from registrar.models import DomainApplication
def index(request): def index(request):
"""This page is available to anyone without logging in.""" """This page is available to anyone without logging in."""
return render(request, "home.html") context = {}
if request.user.is_authenticated:
applications = DomainApplication.objects.filter(creator=request.user)
context["domain_applications"] = applications
return render(request, "home.html", context)