Domain detail view

This commit is contained in:
Neil Martinsen-Burrell 2023-03-09 14:53:54 -06:00
parent bd897695d7
commit b8f3d9bc5d
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
6 changed files with 30 additions and 2 deletions

View file

@ -62,6 +62,7 @@ urlpatterns = [
lambda r: always_404(r, "We forgot to include this link, sorry."), lambda r: always_404(r, "We forgot to include this link, sorry."),
name="todo", name="todo",
), ),
path("domain/<int:pk>", views.DomainView.as_view(), name="domain"),
] ]

View file

@ -0,0 +1,14 @@
{% extends "dashboard_base.html" %}
{% block title %}Domain {{ domain.name }}{% endblock %}
{% block content %}
<main id="main-content" class="grid-container">
<div class="tablet:grid-offset-1 desktop:grid-offset-2">
<h1>{{ domain.name }}</h1>
<p>Active: {% if domain.is_active %}Yes{% else %}No{% endif %}</p>
</div>
</main>
{% endblock %} {# content #}

View file

@ -36,8 +36,8 @@
<td data-sort-value="{{ domain.created_time|date:"U" }}" data-label="Date created">{{ domain.created_time|date }}</td> <td data-sort-value="{{ domain.created_time|date:"U" }}" data-label="Date created">{{ domain.created_time|date }}</td>
<td data-label="Status">{{ domain.application_status|title }}</td> <td data-label="Status">{{ domain.application_status|title }}</td>
<td> <td>
<a href="{% url "todo" %}"> <a href="{% url "domain" pk=domain.pk %}">
Edit <span class="usa-sr-only">{{ domain.name }} </span> Edit <span class="usa-sr-only">{{ domain.name }}</span>
</a> </a>
</td> </td>
</tr> </tr>

View file

@ -1,4 +1,5 @@
from .application import * from .application import *
from .domain import *
from .health import * from .health import *
from .index import * from .index import *
from .profile import * from .profile import *

View file

@ -0,0 +1,11 @@
"""View for a single Domain."""
from django.views.generic import DetailView
from registrar.models import Domain
class DomainView(DetailView):
model = Domain
template_name = "domain_detail.html"
context_object_name = "domain"

View file

@ -13,6 +13,7 @@ def index(request):
domains = request.user.permissions.values( domains = request.user.permissions.values(
"role", "role",
pk=F("domain__id"),
name=F("domain__name"), name=F("domain__name"),
created_time=F("domain__created_at"), created_time=F("domain__created_at"),
application_status=F("domain__domain_application__status"), application_status=F("domain__domain_application__status"),