Minor typo fixes

This commit is contained in:
2020-10-10 10:24:04 +01:00
parent 58b1867a13
commit 5a5bb4328d
4 changed files with 19 additions and 27 deletions

View File

@@ -1,13 +1,8 @@
{% extends 'base_assets.html' %}
{% load widget_tweaks %}
{% block title %}Cable Type{% endblock %}
{% load button from filters %}
{% block content %}
<div class="page-header">
<h1>
{% if create %}Create{% elif edit %}Edit{% endif %} Cable Type
</h1>
</div>
{% if create %}
<form method="POST" action="{% url 'cable_type_create'%}">
{% elif edit %}
@@ -19,26 +14,13 @@
<div class="row">
<div class="col-sm-12">
{% if create or edit %}
{% for field in form %}
<div class="form-group">
<label for="{{ form.plug.id_for_label }}">Plug</label>
{% render_field form.plug|add_class:'form-control'%}
{% include 'partials/form_field.html' with field=field %}
</div>
<div class="form-group">
<label for="{{ form.socket.id_for_label }}">Socket</label>
{% render_field form.socket|add_class:'form-control'%}
</div>
<div class="form-group">
<label for="{{ form.circuits.id_for_label }}">Circuits</label>
{% render_field form.circuits|add_class:'form-control' value=object.circuits %}
</div>
<div class="form-group">
<label for="{{ form.cores.id_for_label }}">Cores</label>
{% render_field form.cores|add_class:'form-control' value=object.cores %}
</div>
<div class="pull-left">
<button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-floppy-disk"></i> Save</button>
<br>
<button type="reset" class="btn btn-link">Cancel</button>
{% endfor %}
<div class="text-right">
{% button 'submit' %}
</div>
{% else %}
<dl>
@@ -54,6 +36,9 @@
<dt>Cores</dt>
<dd>{{ object.cores|default_if_none:'-' }}</dd>
</dl>
<div class="text-right">
{% button 'edit' url='cable_type_update' pk=object.id %}
</div>
{% endif %}
</div>
</div>

View File

@@ -24,8 +24,8 @@
<div class="btn-group" role="group">
{% button 'view' url='asset_detail' pk=item.asset_id clazz="btn-sm" %}
{% if perms.assets.change_asset %}
{% button 'edit' url='asset_detail' pk=item.asset_id clazz="btn-sm" %}
{% button 'duplicate' url='asset_detail' pk=item.asset_id clazz="btn-sm" %}
{% button 'edit' url='asset_update' pk=item.asset_id clazz="btn-sm" %}
{% button 'duplicate' url='asset_duplicate' pk=item.asset_id clazz="btn-sm" %}
{% endif %}
</div>
{% endif %}

View File

@@ -297,6 +297,11 @@ class CableTypeDetail(generic.DetailView):
model = models.CableType
template_name = 'cable_type_form.html'
def get_context_data(self, **kwargs):
context = super(CableTypeDetail, self).get_context_data(**kwargs)
context["page_title"] = "Cable Type {}".format(str(self.object))
return context
class CableTypeCreate(generic.CreateView):
model = models.CableType
@@ -306,6 +311,7 @@ class CableTypeCreate(generic.CreateView):
def get_context_data(self, **kwargs):
context = super(CableTypeCreate, self).get_context_data(**kwargs)
context["create"] = True
context["page_title"] = "Create Cable Type"
return context
@@ -321,6 +327,7 @@ class CableTypeUpdate(generic.UpdateView):
def get_context_data(self, **kwargs):
context = super(CableTypeUpdate, self).get_context_data(**kwargs)
context["edit"] = True
context["page_title"] = "Edit Cable Type"
return context