mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-10-07 21:15:33 +00:00
* Port to Django 5.2 * Pin pluggy to 1.2.0 Any newer and the mystery importlib metadata error appears. Weird! >_> * Update for premailer changed default * Update view logic for is_ajax being changed to a template context processor * Port a few more tests to pytest proper Having two distinct test flavours is giving me a headache * Version 1 dockerfile Makes a VERY big image, I suspect we can optimise this a lot... * Optimise dockerfile a little lot a bit * fix(users): change logout link to POST request * fix(tests): fix some syntax errors in test code still got lots of failed tests :( * fix: replace deprecated Django APIs * ci: update Dockerfile * ci: update Dockerfile * fix(dependencies+tests): update EoL/vulnerable dependencies and improve test stability * Upgrade Python from 3.10 to 3.12 * Update frontend dependencies, replace node-sass with sass * chore(logging): ignore dangling obj reference warning from pypdf * ci: update compose.yml for prod deployment - Add Nginx as a reverse proxy - Add cert-selfsign.sh for generating self-signed certificates - Add certbot-issue.sh for Let's Encrypt certificate issuance and renewal - Add cron-install.sh and cron-uninstall.sh for system cron management - Add .env.example as an environment variable template * style: reformat code * ci: add more sleep trying to pass tests * ci: ignore browser-based tests during ci testing * fix: create home for the new user during Dockerfile building * chore: remove heroku conf file * fix: RIGS not franken anymore * fix: restore is_ajax as a boolean and split out the context processor * test: remove Selenium interaction tests and their CI workarounds * fix: harden production settings (CSRF origins, env casts, ADMINS) and drop dead debug toolbar code * deploy: serve static files from nginx, pin PGDATA, and make cert scripts loud on failure * build: switch .dockerignore to an allowlist * build: drop unused dependencies, soft-pin the rest and target Python 3.14 * build: move image to Python 3.14 / Node 24 and force DEBUG off * ci: add dependabot config for uv, npm, docker and actions * build: narrow Sass deprecation silencing to @import and require Node 24 * build: provide placeholder env for collectstatic now that DEBUG is off in the image * deploy: add plain-HTTP nginx config for local development and use it in compose * deploy: remove self-signed cert script * build: make the image multi-arch with official node and python base images * ci: lint and test on PRs, build the image on PRs and push it to GHCR on master * docs: add local running and sample data instructions * fix: report a form error instead of crashing when big power has no Power MIC * fix: upgrade pypdf and urllib3 to patched releases * fix: apply non-breaking npm audit fixes * fix: strip whitespace in ALLOWED_HOSTS and drop misleading HSTS preload * deploy: add a pyrigs healthcheck and make nginx wait for it * build: pin the uv image version * fix: correct the check-in person picker condition and use BeautifulSoup's string argument * refactor: replace unique_together with UniqueConstraint * build: replace pycodestyle with ruff and fix what it found Removes unused imports and variables, and fixes a few real problems it surfaced: - EventCheckIn.active() referenced an undefined name and raised NameError; it now returns whether the check-in has no end time - RIGS.admin defined EventChecklistAdmin twice; the second is now PowerTestRecordAdmin - RIGS/tests/conftest.py used date/timedelta without importing them - the signal-registering imports in apps.py are kept with noqa pycodestyle config in setup.cfg is dropped. * style: format the codebase with ruff * style: normalise line endings, trailing whitespace and end-of-file newlines * ci: run ruff and file hygiene through prek, and document it --------- Co-authored-by: Hang <me@hangxu.me> Co-authored-by: Joe Banks <joe@jb3.dev>
108 lines
5.3 KiB
HTML
108 lines
5.3 KiB
HTML
{% extends is_ajax|yesno:'base_ajax.html,base_rigs.html' %}
|
|
{% load widget_tweaks %}
|
|
{% load static %}
|
|
{% load button from filters %}
|
|
|
|
{% block css %}
|
|
{{ block.super }}
|
|
<link rel="stylesheet" type="text/css" href="{% static 'css/selects.css' %}"/>
|
|
<link rel="stylesheet" type="text/css" href="{% static 'css/easymde.min.css' %}">
|
|
{% endblock %}
|
|
|
|
{% block preload_js %}
|
|
{{ block.super }}
|
|
<script src="{% static 'js/selects.js' %}"></script>
|
|
<script src="{% static 'js/easymde.min.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
{{ block.super }}
|
|
<script src="{% static 'js/autocompleter.js' %}"></script>
|
|
<script src="{% static 'js/interaction.js' %}"></script>
|
|
<script src="{% static 'js/tooltip.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="col-12">
|
|
{% include 'form_errors.html' %}
|
|
<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 is_ajax and request.user.pk == 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>
|
|
<div class="col-sm-8">
|
|
<select id="{{ form.person.id_for_label }}" name="{{ form.person.name }}" class="px-0 selectpicker" data-live-search="true" data-sourceurl="{% url 'api_secure' model='profile' %}?fields=first_name,last_name,initials">
|
|
{% if form.instance.person %}
|
|
<option value="{{ form.instance.person.pk }}" selected="selected">{{ form.instance.person.name }}</option>
|
|
{% else %}
|
|
<option value="{{ request.user.pk }}" selected="selected">{{ request.user.name }}</option>
|
|
{% endif %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<input type="hidden" name="{{ form.person.name }}" id="{{ form.person.id_for_label }}"
|
|
value="{{request.user.pk}}"/>
|
|
{% endif %}
|
|
{% csrf_token %}
|
|
<div class="form-group">
|
|
<label for="{{ form.time.id_for_label }}"
|
|
class="col-sm-4 col-form-label">Start Time</label>
|
|
<div class="col-sm-8">
|
|
{% render_field form.time class+="form-control" %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="{{ form.role.id_for_label }}" class="col col-form-label">Role</label>
|
|
<div class="row pl-3">
|
|
<div class="col-md-6 col-sm-12">
|
|
<button type="button" class="btn btn-primary" onclick="document.getElementById('id_role').value='MIC'">MIC</button>
|
|
<button type="button" class="btn btn-danger" onclick="document.getElementById('id_role').value='Power MIC'">Power MIC</button>
|
|
<button type="button" class="btn btn-info" onclick="document.getElementById('id_role').value='Crew'">Crew</button>
|
|
</div>
|
|
<div class="col-md-6 mt-2">
|
|
{% render_field form.role class+="form-control" placeholder="Other (enter text)" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="{{ form.vehicle.id_for_label }}" class="col col-form-label">Vehicle (if applicable)</label>
|
|
<div class="row pl-3">
|
|
<div class="col-md-6 col-sm-12">
|
|
<button type="button" class="btn btn-primary" onclick="document.getElementById('id_vehicle').value='Virgil'"><span class="fas fa-truck-moving"></span> Virgil</button>
|
|
<button type="button" class="btn btn-secondary" onclick="document.getElementById('id_vehicle').value='Virgil + Erms'"><span class="fas fa-trailer"></span><span class="fas fa-truck-moving"></span> Virgil + Erms</button>
|
|
</div>
|
|
<div class="col-md-6 mt-2">
|
|
{% render_field form.vehicle class+="form-control" placeholder="Other (enter text)" %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% if edit or manual %}
|
|
<div class="form-group">
|
|
<label for="{{ form.end_time.id_for_label }}"
|
|
class="col-sm-4 col-form-label">End Time</label>
|
|
<div class="col-sm-8">
|
|
{% render_field form.end_time class+="form-control" %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% if not is_ajax %}
|
|
<div class="row mt-3">
|
|
<div class="col-sm-12 text-right">
|
|
{% button 'submit' %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</form>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block footer %}
|
|
<div class="col-sm-12 text-right pr-0">
|
|
<button type="submit" class="btn btn-primary" title="Save" form="checkin"
|
|
><span class="fas fa-save align-middle"></span> <span class="d-none d-sm-inline align-middle">Save</span></button>
|
|
</div>
|
|
{% endblock %}
|