Headers fixed

This commit is contained in:
Sebastian Lohff 2017-03-27 02:40:01 +02:00
parent e6e6d350f8
commit 337184baa6
6 changed files with 8 additions and 29 deletions

View File

@ -6,7 +6,7 @@
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Header</div>
<div class="panel-heading">Edit {{ form.instance }} <small>({{ form.instance.getClassName }})</small></div>
<div class="panel-body">
<form method="post" action="#">
{% csrf_token %}

View File

@ -12,15 +12,15 @@
{% for field in object|getFields:user %}
<tr>
<td>{{ field.0 }}</td>
<td>{% if field.1.through %}{{ field.1.all|linkObjects }}{% else %}{{ field.1 }}{% endif %}</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 "whoisdb:"|add:object.getClassName|lower|add:"-edit" as editView %}
{% with "whoisdb:"|add:object.getClassName|lower|add:"-delete" as deleteView %}
<td><a href="{% url editView handle=object.handle %}">Edit object<a/>, <a href="{% url deleteView handle=object.handle %}">Delete object</a></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>

View File

@ -1,21 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Header</div>
<div class="panel-body">
<form method="post" action="#">
{% csrf_token %}
{{ form | crispy }}
<button type="submit" class="btn btn-primary">Create</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -6,7 +6,7 @@
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">Header</div>
<div class="panel-heading">Edit {{ form.instance }} <small>({{ form.instance.getClassName }})</small></div>
<div class="panel-body">
<form method="post" action="#">
{% csrf_token %}

View File

@ -84,7 +84,7 @@ class Maintainer(WhoisObject):
handle = models.SlugField(max_length=32, unique=True, verbose_name='handle', validators=[HandleValidatorWithSuffix('MNT')], help_text="Must end with -MNT, eg FOO3-MNT")
description = models.CharField(max_length=64, blank=True, help_text="Short description what this maintainer is for")
admin_c = models.ManyToManyField("Contact")
admin_c = models.ManyToManyField("Contact", verbose_name="Administrative Contact")
rir = models.BooleanField(default=False)
lir = models.BooleanField(default=False)

View File

@ -104,7 +104,7 @@ class MaintainerCreate(LoginRequiredMixin, CreateView):
class MaintainerEdit(LoginRequiredMixin, UpdateView):
template_name = "whoisdb/maintainer_edit.html"
template_name = "whoisdb/obj_edit.html"
model = Maintainer
form_class = MntForm
slug_field = "handle"