mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
feat(people): Add people list view
This commit is contained in:
@@ -108,7 +108,7 @@
|
||||
|
||||
{# Global banner if config.NOTICE_TEXT is set using Constance #}
|
||||
{% if config.NOTICE_TEXT %}
|
||||
<div class="alert {{ config.NOTICE_CLASS }} rounded-0 mb-0" role="alert">
|
||||
<div class="alert {{ config.NOTICE_CLASS }} rounded-0 mb-3" role="alert">
|
||||
<h4 class="alert-heading text-center mb-0">{{ config.NOTICE_TEXT }}</h4>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
37
people/templates/people/person/list.html
Normal file
37
people/templates/people/person/list.html
Normal file
@@ -0,0 +1,37 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page">People</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<hr>
|
||||
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for person in person_list.all %}
|
||||
<tr>
|
||||
<td>{{ person }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'people:person.detail' pk=person.pk %}">Profile</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td>No records</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
@@ -10,6 +10,10 @@ urlpatterns = [
|
||||
views.ProfileView.as_view(),
|
||||
name='person.profile'),
|
||||
|
||||
path('people',
|
||||
views.PersonListView.as_view(),
|
||||
name='person.list'),
|
||||
|
||||
path('people/<int:pk>',
|
||||
views.ProfileView.as_view(),
|
||||
name='person.detail'),
|
||||
|
||||
@@ -2,18 +2,25 @@
|
||||
Views for displaying or manipulating models in the 'people' app.
|
||||
"""
|
||||
|
||||
from django.views.generic import DetailView
|
||||
from django.views.generic import DetailView, ListView
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
class PersonListView(ListView):
|
||||
"""
|
||||
View displaying a list of :class:`Person` objects - searchable.
|
||||
"""
|
||||
model = models.Person
|
||||
template_name = 'people/person/list.html'
|
||||
|
||||
|
||||
class ProfileView(DetailView):
|
||||
"""
|
||||
View displaying the profile of a :class:`Person` - who may be a user.
|
||||
"""
|
||||
model = models.Person
|
||||
template_name = 'people/person/detail.html'
|
||||
context_object_name = 'person'
|
||||
|
||||
|
||||
class RelationshipDetailView(DetailView):
|
||||
@@ -22,4 +29,3 @@ class RelationshipDetailView(DetailView):
|
||||
"""
|
||||
model = models.Relationship
|
||||
template_name = 'people/relationship/detail.html'
|
||||
context_object_name = 'relationship'
|
||||
|
||||
Reference in New Issue
Block a user