handle_show cleanup

This commit is contained in:
Sebastian Lohff 2017-03-28 01:46:47 +02:00
parent faa79edfc6
commit b1854b3f3b
3 changed files with 4 additions and 55 deletions

View File

@ -40,7 +40,7 @@ class DomainDetail(LoginRequiredMixin, DetailView):
slug_url_kwarg = "domain" slug_url_kwarg = "domain"
context_object_name = "domain" context_object_name = "domain"
template_name = "domains/handle_show.html" template_name = "whoisdb/handle_show.html"
class DomainEdit(MntGenericMixin, LoginRequiredMixin, UpdateView): class DomainEdit(MntGenericMixin, LoginRequiredMixin, UpdateView):
@ -80,7 +80,7 @@ class NameserverDetail(LoginRequiredMixin, DetailView):
#slug_field = "name" #slug_field = "name"
#slug_url_kwarg = "domain" #slug_url_kwarg = "domain"
#context_object_name = "nameserver" #context_object_name = "nameserver"
template_name = "domains/handle_show.html" template_name = "whoisdb/handle_show.html"
class NameserverEdit(MntGenericMixin, LoginRequiredMixin, UpdateView): class NameserverEdit(MntGenericMixin, LoginRequiredMixin, UpdateView):
@ -120,7 +120,7 @@ class ReverseZoneDetail(LoginRequiredMixin, DetailView):
#slug_field = "name" #slug_field = "name"
#slug_url_kwarg = "domain" #slug_url_kwarg = "domain"
#context_object_name = "nameserver" #context_object_name = "nameserver"
template_name = "domains/handle_show.html" template_name = "whoisdb/handle_show.html"
class ReverseZoneEdit(MntGenericMixin, LoginRequiredMixin, UpdateView): class ReverseZoneEdit(MntGenericMixin, LoginRequiredMixin, UpdateView):

View File

@ -1,34 +0,0 @@
{% extends "base.html" %}
{% load handletags %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">{{ object }} <small>({{ object.getClassName }})</small></div>
<div class="panel-body">
<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>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -8,24 +8,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">{{ object }} <small>({{ object.getClassName }})</small></div> <div class="panel-heading">{{ object }} <small>({{ object.getClassName }})</small></div>
<div class="panel-body"> <div class="panel-body">
<table class="table"> {% include "whoisdb/handle_table.html" with object=object %}
{% 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>
</div> </div>
</div> </div>
</div> </div>