parent
33de8402b7
commit
231f8a7f30
@ -0,0 +1,19 @@
|
||||
{% load handletags %}
|
||||
<table class="table">
|
||||
{% for field in object|getFields:user %}
|
||||
<tr>
|
||||
<td>{{ field.0 }}</td>
|
||||
<td>{% if field.1.through %}{{ field.1.all|linkObjects|default:"-" }}{% else %}{{ field.1|default:"-" }}{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if object|userCanEdit:user %}
|
||||
<tr>
|
||||
<td>Actions</td>
|
||||
{% with request.resolver_match.namespaces.0|add:":"|add:object.getClassName|lower|add:"-edit" as editView %}
|
||||
{% with request.resolver_match.namespaces.0|add:":"|add:object.getClassName|lower|add:"-delete" as deleteView %}
|
||||
<td><a href="{% url editView object.getPK %}">Edit object<a/>, <a href="{% url deleteView object.getPK %}">Delete object</a></td>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
@ -0,0 +1,32 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Search {% if term %}for {{ term }}{% else %}database{% endif %}</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<form class="form" method="post" action="{% url "whoisdb:search" %}">
|
||||
{% csrf_token %}
|
||||
<input type="text" name="q" placeholder="Search in DB">
|
||||
<button class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</p>
|
||||
{% if term %}
|
||||
<p>
|
||||
<h3>Search for '{{ term }}'</h3>
|
||||
{% for obj in results %}
|
||||
<h5>{{ obj }}</h5>
|
||||
{% include "whoisdb/handle_table.html" with object=obj %}
|
||||
{% empty %}
|
||||
No objects found.
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in new issue