mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Port to Django 5.2
This commit is contained in:
@@ -39,6 +39,8 @@ class EventForm(forms.ModelForm):
|
||||
@property
|
||||
def _get_items_json(self):
|
||||
items = {}
|
||||
if self.instance.pk is None:
|
||||
return items
|
||||
for item in self.instance.items.all():
|
||||
data = serializers.serialize('json', [item])
|
||||
struct = simplejson.loads(data)
|
||||
|
||||
@@ -5,7 +5,7 @@ import urllib.request
|
||||
from io import BytesIO
|
||||
import datetime
|
||||
|
||||
from PyPDF2 import PdfFileReader, PdfFileMerger
|
||||
from PyPDF2 import PdfReader, PdfMerger
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles import finders
|
||||
from django.core.cache import cache
|
||||
@@ -31,12 +31,12 @@ def send_eventauthorisation_success_email(instance):
|
||||
}
|
||||
|
||||
template = get_template('event_print.xml')
|
||||
merger = PdfFileMerger()
|
||||
merger = PdfMerger()
|
||||
|
||||
rml = template.render(context)
|
||||
|
||||
buffer = rml2pdf.parseString(rml)
|
||||
merger.append(PdfFileReader(buffer))
|
||||
merger.append(PdfReader(buffer))
|
||||
buffer.close()
|
||||
|
||||
terms = urllib.request.urlopen(settings.TERMS_OF_HIRE_URL)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Hi {{object.event.mic.get_full_name|default_if_none:"somebody"}},
|
||||
|
||||
Just to let you know your event N{{object.eventdisplay_id}} has been successfully authorised for £{{object.amount}} by {{object.name}} as of {{object.event.last_edited_at}}.
|
||||
Just to let you know your event N{{object.event.pk|stringformat:"05d"}} has been successfully authorised for £{{object.amount}} by {{object.name}} as of {{object.event.last_edited_at}}.
|
||||
|
||||
The TEC Rig Information Gathering System
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% extends is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
|
||||
{% load markdown_tags %}
|
||||
{% load static %}
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row my-3 py-3">
|
||||
{% if not request.is_ajax %}
|
||||
{% if not is_ajax %}
|
||||
{% if perms.RIGS.view_event %}
|
||||
<div class="col-sm-12 text-right">
|
||||
{% include 'partials/event_detail_buttons.html' %}
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if not request.is_ajax and perms.RIGS.view_event %}
|
||||
{% if not is_ajax and perms.RIGS.view_event %}
|
||||
<div class="col-sm-12 text-right">
|
||||
{% include 'partials/event_detail_buttons.html' %}
|
||||
</div>
|
||||
@@ -69,16 +69,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'partials/crew_list.html' %}
|
||||
|
||||
{% if not request.is_ajax and perms.RIGS.view_event %}
|
||||
{% if not is_ajax and perms.RIGS.view_event %}
|
||||
<div class="col-sm-12 text-right">
|
||||
{% include 'partials/event_detail_buttons.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if not request.is_ajax and perms.RIGS.view_event %}
|
||||
{% if not is_ajax and perms.RIGS.view_event %}
|
||||
<div class="col-sm-12 text-right">
|
||||
{% include 'partials/last_edited.html' with target="event_history" %}
|
||||
</div>
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% if request.is_ajax %}
|
||||
{% if is_ajax %}
|
||||
{% block footer %}
|
||||
{% if perms.RIGS.view_event %}
|
||||
{% include 'partials/last_edited.html' with target="event_history" %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
{% load static %}
|
||||
{% load button from filters %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
|
||||
{% block title %}TEC Email Address Required{% endblock %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% extends is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% load help_text from filters %}
|
||||
{% load profile_by_index from filters %}
|
||||
{% load yesnoi from filters %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
{% load static %}
|
||||
{% load help_text from filters %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
{% load static %}
|
||||
{% load button from filters %}
|
||||
@@ -28,7 +28,7 @@
|
||||
<form id="checkin" role="form" method="POST" action="{{ form.action|default:request.path }}">
|
||||
<input type="hidden" name="{{ form.event.name }}" id="{{ form.event.id_for_label }}"
|
||||
value="{{event.pk}}"/>
|
||||
{% if not request.is_ajax and self.request.user.pk is form.event.mic.pk %}
|
||||
{% if not is_ajax and self.request.user.pk is form.event.mic.pk %}
|
||||
<div class="form-group">
|
||||
<label for="{{ form.person.id_for_label }}"
|
||||
class="col-sm-4 col-form-label">{{ form.person.label }}</label>
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not request.is_ajax %}
|
||||
{% if not is_ajax %}
|
||||
<div class="row mt-3">
|
||||
<div class="col-sm-12 text-right">
|
||||
{% button 'submit' %}
|
||||
|
||||
59
RIGS/templates/hs/hs_object_list.html
Normal file
59
RIGS/templates/hs/hs_object_list.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
{% load paginator from filters %}
|
||||
{% load help_text from filters %}
|
||||
{% load verbose_name from filters %}
|
||||
{% load get_field from filters %}
|
||||
|
||||
{% block title %}{{ title }} List{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>{{title}} List</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table mb-0 table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Event</th>
|
||||
{# mmm hax #}
|
||||
{% if object_list.0 != None %}
|
||||
{% for field in object_list.0.fieldz %}
|
||||
<th scope="col">{{ object_list.0|verbose_name:field|title }}</th>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for object in object_list %}
|
||||
<tr class="{% if object.reviewed_by %}table-success{%endif%}">
|
||||
{# General #}
|
||||
<th scope="row"><a href="{% url 'event_detail' object.event.pk %}">{{ object.event }}</a><br><small>{{ object.event.get_status_display }}</small></th>
|
||||
{% for field in object_list.0.fieldz %}
|
||||
<td>{{ object|get_field:field }}</td>
|
||||
{% endfor %}
|
||||
{# Buttons #}
|
||||
<td>
|
||||
{% include 'partials/hs_status.html' %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr class="bg-warning">
|
||||
<td colspan="6">Nothing found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if is_paginated %}
|
||||
<div class="row justify-content-center">
|
||||
{% paginator %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% extends is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% load help_text from filters %}
|
||||
{% load profile_by_index from filters %}
|
||||
{% load yesnoi from filters %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
{% load static %}
|
||||
{% load help_text from filters %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% extends is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% load filters %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends request.is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
||||
{% load widget_tweaks %}
|
||||
{% load static %}
|
||||
{% load help_text from filters %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<label for="{{ formitem.id_for_label }}"
|
||||
<label for="{{ formitem.0.id_for_label }}"
|
||||
class="col-8 control-label">{{ formitem.help_text|safe }}</label>
|
||||
<div class="col-4 pb-3" id="{{ formitem.id_for_label|slice:'-2' }}">
|
||||
<div class="col-4 pb-3" id="{{ formitem.0.id_for_label|slice:'-2' }}">
|
||||
{% for radio in formitem %}
|
||||
<div class="custom-control custom-radio">
|
||||
{{ radio.tag }}
|
||||
|
||||
Reference in New Issue
Block a user