mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Misc fixes
This commit is contained in:
@@ -230,6 +230,7 @@ class PaymentCreate(generic.CreateView):
|
||||
|
||||
class PaymentDelete(generic.DeleteView):
|
||||
model = models.Payment
|
||||
template_name = 'payment_confirm_delete.html'
|
||||
|
||||
def get_success_url(self):
|
||||
return self.request.POST.get('next')
|
||||
|
||||
@@ -199,13 +199,13 @@ class EventChecklistForm(forms.ModelForm):
|
||||
self.items['v' + str(pk)] = item
|
||||
|
||||
crewmembers = {key: val for key, val in self.data.items()
|
||||
if key.startswith('crewmember')}
|
||||
other_fields = ['start','role','end']
|
||||
if key.startswith('crewmember')}
|
||||
other_fields = ['start', 'role', 'end']
|
||||
for key in crewmembers:
|
||||
pk = int(key.split('_')[1])
|
||||
|
||||
for field in other_fields:
|
||||
value = self.data['{}_{}'.format(field,pk)]
|
||||
value = self.data['{}_{}'.format(field, pk)]
|
||||
if value == '':
|
||||
raise forms.ValidationError('Add a {} to crewmember {}'.format(field, pk), code='{}_mismatch'.format(field))
|
||||
|
||||
|
||||
43
RIGS/migrations/0050_auto_20200830_1048.py
Normal file
43
RIGS/migrations/0050_auto_20200830_1048.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Generated by Django 3.1 on 2020-08-30 09:48
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0049_auto_20200829_2313'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_earth_fault',
|
||||
field=models.IntegerField(help_text='Earth Fault Loop Impedance (Z<small>S</small>)', verbose_name='Earth Fault Loop Impedance'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_phase_rotation',
|
||||
field=models.BooleanField(help_text='Phase Rotation<br><small>(if required)</small>', verbose_name='Phase Rotation'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_pssc',
|
||||
field=models.IntegerField(help_text='Prospective Short Circuit Current', verbose_name='PSCC'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_voltage_l1',
|
||||
field=models.IntegerField(help_text='L1 - N', verbose_name='First Distro Voltage L1-N'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_voltage_l2',
|
||||
field=models.IntegerField(help_text='L2 - N', verbose_name='First Distro Voltage L2-N'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='eventchecklist',
|
||||
name='fd_voltage_l3',
|
||||
field=models.IntegerField(help_text='L3 - N', verbose_name='First Distro Voltage L3-N'),
|
||||
),
|
||||
]
|
||||
@@ -666,12 +666,12 @@ class EventChecklist(models.Model, RevisionMixin):
|
||||
source_rcd = models.BooleanField(help_text="Source RCD protected?<br><small>(if cable is more than 3m long) </small>")
|
||||
labelling = models.BooleanField(help_text="Appropriate and clear labelling on distribution and cabling?")
|
||||
# First Distro
|
||||
fd_voltage_l1 = models.IntegerField(help_text="L1 - N")
|
||||
fd_voltage_l2 = models.IntegerField(help_text="L2 - N")
|
||||
fd_voltage_l3 = models.IntegerField(help_text="L3 - N")
|
||||
fd_phase_rotation = models.BooleanField(help_text="Phase Rotation<br><small>(if required)</small>")
|
||||
fd_earth_fault = models.IntegerField(help_text="Earth Fault Loop Impedance (Z<small>S</small>)")
|
||||
fd_pssc = models.IntegerField(help_text="Prospective Short Circuit Current")
|
||||
fd_voltage_l1 = models.IntegerField(verbose_name="First Distro Voltage L1-N", help_text="L1 - N")
|
||||
fd_voltage_l2 = models.IntegerField(verbose_name="First Distro Voltage L2-N", help_text="L2 - N")
|
||||
fd_voltage_l3 = models.IntegerField(verbose_name="First Distro Voltage L3-N", help_text="L3 - N")
|
||||
fd_phase_rotation = models.BooleanField(verbose_name="Phase Rotation", help_text="Phase Rotation<br><small>(if required)</small>")
|
||||
fd_earth_fault = models.IntegerField(verbose_name="Earth Fault Loop Impedance", help_text="Earth Fault Loop Impedance (Z<small>S</small>)")
|
||||
fd_pssc = models.IntegerField(verbose_name="PSCC", help_text="Prospective Short Circuit Current")
|
||||
|
||||
all_rcds_tested = models.BooleanField(help_text="All circuit RCDs tested?<small>(using test button)</small>")
|
||||
public_sockets_tested = models.BooleanField(help_text="Public/Performer accessible circuits tested?<small>(using socket tester)</small>")
|
||||
|
||||
@@ -286,7 +286,7 @@
|
||||
<tr>
|
||||
<td>{% render_field form.fd_voltage_l1 class+="form-control" %}</td>
|
||||
<td>{% render_field form.fd_voltage_l2 class+="form-control" %}</td>
|
||||
<td>{% render_field form.fd_voltage_l1 class+="form-control" %}</td>
|
||||
<td>{% render_field form.fd_voltage_l3 class+="form-control" %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{{object|help_text:'fd_phase_rotation'|safe}}</th>
|
||||
|
||||
@@ -96,17 +96,12 @@
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="card card-default">
|
||||
<div class="card-body">
|
||||
{% with object.event as object %}
|
||||
{% include 'item_table.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div class="card">
|
||||
{% with object.event as object %}
|
||||
{% include 'item_table.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-right">
|
||||
{% include 'partials/last_edited.html' with target="invoice_history" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,48 +4,40 @@
|
||||
{% block title %}Add Payment{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<form action="{{ form.action|default:request.path }}" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="{{ form.invoice.name }}" value="{{ form.invoice.value }}"/>
|
||||
|
||||
<div class="row">
|
||||
{% include 'form_errors.html' %}
|
||||
<div class="form-group col-sm">
|
||||
<label class="col-sm-2 control-label"
|
||||
for="{{ form.date.id_for_label }}">{{ form.date.label }}</label>
|
||||
<div class="col-sm-10">
|
||||
{% render_field form.date class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-xs-12">
|
||||
<label class="col-sm-2 control-label"
|
||||
for="{{ form.amount.id_for_label }}">{{ form.amount.label }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">£</span>
|
||||
</div>
|
||||
{% render_field form.amount class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm">
|
||||
<label class="col-sm-2 control-label"
|
||||
for="{{ form.method.id_for_label }}">{{ form.method.label }}</label>
|
||||
<div class="col-sm-10">
|
||||
{% render_field form.method class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-right col-sm">
|
||||
<div class="form-group">
|
||||
<input type="submit" class="form-control btn btn-primary"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="{{ form.action|default:request.path }}" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="{{ form.invoice.name }}" value="{{ form.invoice.value }}"/>
|
||||
{% include 'form_errors.html' %}
|
||||
<div class="row pt-3">
|
||||
<label class="col-sm-4 control-label"
|
||||
for="{{ form.date.id_for_label }}">{{ form.date.label }}</label>
|
||||
<div class="col-sm-8">
|
||||
{% render_field form.date class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pt-3">
|
||||
<label class="col-sm-4 control-label"
|
||||
for="{{ form.amount.id_for_label }}">{{ form.amount.label }}</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">£</span>
|
||||
</div>
|
||||
{% render_field form.amount class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pt-3">
|
||||
<label class="col-sm-4 control-label"
|
||||
for="{{ form.method.id_for_label }}">{{ form.method.label }}</label>
|
||||
<div class="col-sm-8">
|
||||
{% render_field form.method class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pt-3">
|
||||
<div class="col-sm-12 text-right">
|
||||
<input type="submit" class="form-control btn btn-primary"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
@@ -137,6 +137,7 @@ def profile_by_index(value):
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
@register.filter
|
||||
def next(alist, current_index):
|
||||
"""
|
||||
@@ -144,6 +145,6 @@ def next(alist, current_index):
|
||||
Otherwise returns an empty string.
|
||||
"""
|
||||
try:
|
||||
return alist[int(current_index) + 1] # access the next element
|
||||
except:
|
||||
return '' # return empty string in case of exception
|
||||
return alist[int(current_index) + 1] # access the next element
|
||||
except BaseException:
|
||||
return '' # return empty string in case of exception
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<input id="id_search_input" type="search" name="q" class="form-control form-control-sm" placeholder="Search..." value="{{ request.GET.q }}" />
|
||||
</div>
|
||||
<select id="search-options" class="custom-select form-control">
|
||||
<select id="search-options" class="custom-select form-control" style="border-top-right-radius: 0px; border-bottom-right-radius: 0px;">
|
||||
<option selected data-action="{% url 'event_archive' %}" href="#">Events</option>
|
||||
<option data-action="{% url 'person_list' %}" href="#">People</option>
|
||||
<option data-action="{% url 'organisation_list' %}" href="#">Organisations</option>
|
||||
@@ -16,7 +16,7 @@
|
||||
<option data-action="{% url 'supplier_list' %}" href="#">Suppliers</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-primary form-control form-control-sm btn-sm">Search</button>
|
||||
<button class="btn btn-primary form-control form-control-sm btn-sm" style="border-top-left-radius: 0px;border-bottom-left-radius: 0px;">Search</button>
|
||||
<a href="{% url 'search_help' %}" class="nav-link modal-href btn-sm"><span class="fas fa-question-circle"></span></a>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
@@ -128,12 +128,12 @@ class ModelComparison(object):
|
||||
item_dict = {} # build a list of items, key is the item_pk
|
||||
# FIXME Removing the if checks makes things REALLY slow...
|
||||
for version in old_item_versions: # put all the old versions in a list
|
||||
#if version.field_dict["event_id"] == int(self.new.pk):
|
||||
# if version.field_dict["event_id"] == int(self.new.pk):
|
||||
compare = ModelComparison(old=version._object_version.object, **comparisonParams)
|
||||
item_dict[version.object_id] = compare
|
||||
|
||||
for version in new_item_versions: # go through the new versions
|
||||
#if version.field_dict["event_id"] == int(self.new.pk):
|
||||
# if version.field_dict["event_id"] == int(self.new.pk):
|
||||
try:
|
||||
compare = item_dict[version.object_id] # see if there's a matching old version
|
||||
compare.new = version._object_version.object # then add the new version to the dictionary
|
||||
|
||||
Reference in New Issue
Block a user