mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-21 23:42:14 +00:00
Create the training database (#463)
Co-authored-by: josephjboyden <josephjboyden@gmail.com>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
default_app_config = 'RIGS.apps.RIGSAppConfig'
|
||||
|
||||
@@ -14,7 +14,7 @@ from reversion.admin import VersionAdmin
|
||||
from RIGS import models
|
||||
from users import forms as user_forms
|
||||
|
||||
# Register your models here.
|
||||
|
||||
admin.site.register(models.VatRate, VersionAdmin)
|
||||
admin.site.register(models.Event, VersionAdmin)
|
||||
admin.site.register(models.EventItem, VersionAdmin)
|
||||
|
||||
@@ -24,7 +24,7 @@ class InvoiceIndex(generic.ListView):
|
||||
template_name = 'invoice_list.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(InvoiceIndex, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
total = 0
|
||||
for i in context['object_list']:
|
||||
total += i.balance
|
||||
@@ -41,8 +41,9 @@ class InvoiceDetail(generic.DetailView):
|
||||
template_name = 'invoice_detail.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(InvoiceDetail, self).get_context_data(**kwargs)
|
||||
context['page_title'] = "Invoice {} ({}) ".format(self.object.display_id, self.object.invoice_date.strftime("%d/%m/%Y"))
|
||||
context = super().get_context_data(**kwargs)
|
||||
invoice_date = self.object.invoice_date.strftime("%d/%m/%Y")
|
||||
context['page_title'] = f"Invoice {self.object.display_id} ({invoice_date}) "
|
||||
if self.object.void:
|
||||
context['page_title'] += "<span class='badge badge-warning float-right'>VOID</span>"
|
||||
elif self.object.is_closed:
|
||||
@@ -117,7 +118,7 @@ class InvoiceArchive(generic.ListView):
|
||||
paginate_by = 25
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(InvoiceArchive, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = "Invoice Archive"
|
||||
context['description'] = "This page displays all invoices: outstanding, paid, and void"
|
||||
return context
|
||||
@@ -196,7 +197,7 @@ class PaymentCreate(generic.CreateView):
|
||||
template_name = 'payment_form.html'
|
||||
|
||||
def get_initial(self):
|
||||
initial = super(generic.CreateView, self).get_initial()
|
||||
initial = super().get_initial()
|
||||
invoicepk = self.request.GET.get('invoice', self.request.POST.get('invoice', None))
|
||||
if invoicepk is None:
|
||||
raise Http404()
|
||||
|
||||
@@ -8,6 +8,7 @@ from django.utils import timezone
|
||||
from reversion import revisions as reversion
|
||||
|
||||
from RIGS import models
|
||||
from training.models import TrainingLevel
|
||||
|
||||
# Override the django form defaults to use the HTML date/time/datetime UI elements
|
||||
forms.DateField.widget = forms.DateInput(attrs={'type': 'date'})
|
||||
@@ -96,10 +97,10 @@ class EventForm(forms.ModelForm):
|
||||
raise forms.ValidationError(
|
||||
'You haven\'t provided any client contact details. Please add a person or organisation.',
|
||||
code='contact')
|
||||
return super(EventForm, self).clean()
|
||||
return super().clean()
|
||||
|
||||
def save(self, commit=True):
|
||||
m = super(EventForm, self).save(commit=False)
|
||||
m = super().save(commit=False)
|
||||
|
||||
if (commit):
|
||||
m.save()
|
||||
@@ -138,7 +139,7 @@ class BaseClientEventAuthorisationForm(forms.ModelForm):
|
||||
|
||||
class InternalClientEventAuthorisationForm(BaseClientEventAuthorisationForm):
|
||||
def __init__(self, **kwargs):
|
||||
super(InternalClientEventAuthorisationForm, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
self.fields['uni_id'].required = True
|
||||
self.fields['account_code'].required = True
|
||||
|
||||
@@ -153,7 +154,7 @@ class EventAuthorisationRequestForm(forms.Form):
|
||||
|
||||
class EventRiskAssessmentForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EventRiskAssessmentForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
for name, field in self.fields.items():
|
||||
if str(name) == 'supervisor_consulted':
|
||||
field.widget = forms.CheckboxInput()
|
||||
@@ -164,6 +165,9 @@ class EventRiskAssessmentForm(forms.ModelForm):
|
||||
], attrs={'class': 'custom-control-input', 'required': 'true'})
|
||||
|
||||
def clean(self):
|
||||
if self.cleaned_data.get('big_power'):
|
||||
if not self.cleaned_data.get('power_mic').level_qualifications.filter(level__department=TrainingLevel.POWER).exists():
|
||||
self.add_error('power_mic', forms.ValidationError("Your Power MIC must be a Power Technician.", code="power_tech_required"))
|
||||
# Check expected values
|
||||
unexpected_values = []
|
||||
for field, value in models.RiskAssessment.expected_values.items():
|
||||
@@ -181,7 +185,7 @@ class EventRiskAssessmentForm(forms.ModelForm):
|
||||
|
||||
class EventChecklistForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(EventChecklistForm, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['date'].widget.format = '%Y-%m-%d'
|
||||
for name, field in self.fields.items():
|
||||
if field.__class__ == forms.NullBooleanField:
|
||||
|
||||
@@ -3,6 +3,7 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
from django.contrib.auth.models import Group
|
||||
from assets import models
|
||||
from RIGS import models as rigsmodels
|
||||
from training import models as tmodels
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -31,6 +32,11 @@ class Command(BaseCommand):
|
||||
self.delete_objects(rigsmodels.Payment)
|
||||
self.delete_objects(rigsmodels.RiskAssessment)
|
||||
self.delete_objects(rigsmodels.EventChecklist)
|
||||
self.delete_objects(tmodels.TrainingCategory)
|
||||
self.delete_objects(tmodels.TrainingItem)
|
||||
self.delete_objects(tmodels.TrainingLevel)
|
||||
self.delete_objects(tmodels.TrainingItemQualification)
|
||||
self.delete_objects(tmodels.TrainingLevelRequirement)
|
||||
|
||||
def delete_objects(self, model):
|
||||
for obj in model.objects.all():
|
||||
|
||||
@@ -12,3 +12,4 @@ class Command(BaseCommand):
|
||||
call_command('generateSampleUserData')
|
||||
call_command('generateSampleRIGSData')
|
||||
call_command('generateSampleAssetsData')
|
||||
call_command('generateSampleTrainingData')
|
||||
|
||||
@@ -21,6 +21,7 @@ class Command(BaseCommand):
|
||||
profiles = models.Profile.objects.all()
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Generating rigboard data")
|
||||
from django.conf import settings
|
||||
|
||||
if not (settings.DEBUG or settings.STAGING):
|
||||
@@ -35,6 +36,7 @@ class Command(BaseCommand):
|
||||
self.setup_organisations()
|
||||
self.setup_venues()
|
||||
self.setup_events()
|
||||
print("Done generating rigboard data")
|
||||
|
||||
def setup_people(self):
|
||||
names = ["Regulus Black", "Sirius Black", "Lavender Brown", "Cho Chang", "Vincent Crabbe", "Vincent Crabbe",
|
||||
|
||||
18
RIGS/migrations/0043_auto_20211027_1519.py
Normal file
18
RIGS/migrations/0043_auto_20211027_1519.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.13 on 2021-10-27 14:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0042_auto_20211007_2338'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='profile',
|
||||
name='initials',
|
||||
field=models.CharField(max_length=5, null=True),
|
||||
),
|
||||
]
|
||||
18
RIGS/migrations/0044_profile_is_supervisor.py
Normal file
18
RIGS/migrations/0044_profile_is_supervisor.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.11 on 2022-01-09 14:56
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0043_auto_20211027_1519'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='profile',
|
||||
name='is_supervisor',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
25
RIGS/migrations/0045_legacy_supervisors.py
Normal file
25
RIGS/migrations/0045_legacy_supervisors.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.11 on 2022-01-09 15:00
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
from training.models import TrainingLevel
|
||||
|
||||
def find_existing_supervisors(apps, schema_editor):
|
||||
Profile = apps.get_model('RIGS', 'Profile')
|
||||
for person in Profile.objects.all():
|
||||
if person.level_qualifications.exclude(confirmed_on=None).select_related('level') \
|
||||
.filter(level__level__gte=TrainingLevel.SUPERVISOR) \
|
||||
.exclude(level__department=TrainingLevel.HAULAGE) \
|
||||
.exclude(level__department__isnull=True).exists():
|
||||
person.is_supervisor = True
|
||||
person.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('RIGS', '0044_profile_is_supervisor'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(find_existing_supervisors, migrations.RunPython.noop)
|
||||
]
|
||||
@@ -17,17 +17,19 @@ from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from reversion import revisions as reversion
|
||||
from reversion.models import Version
|
||||
from versioning.versioning import RevisionMixin
|
||||
|
||||
|
||||
class Profile(AbstractUser):
|
||||
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
||||
initials = models.CharField(max_length=5, null=True, blank=False)
|
||||
phone = models.CharField(max_length=13, blank=True, default='')
|
||||
api_key = models.CharField(max_length=40, blank=True, editable=False, default='')
|
||||
is_approved = models.BooleanField(default=False)
|
||||
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
|
||||
last_emailed = models.DateTimeField(blank=True, null=True)
|
||||
dark_theme = models.BooleanField(default=False)
|
||||
is_supervisor = models.BooleanField(default=False)
|
||||
|
||||
reversion_hide = True
|
||||
|
||||
@classmethod
|
||||
def make_api_key(cls):
|
||||
@@ -67,6 +69,39 @@ class Profile(AbstractUser):
|
||||
return self.name
|
||||
|
||||
|
||||
class RevisionMixin:
|
||||
@property
|
||||
def is_first_version(self):
|
||||
versions = Version.objects.get_for_object(self)
|
||||
return len(versions) == 1
|
||||
|
||||
@property
|
||||
def current_version(self):
|
||||
version = Version.objects.get_for_object(self).select_related('revision').first()
|
||||
return version
|
||||
|
||||
@property
|
||||
def last_edited_at(self):
|
||||
version = self.current_version
|
||||
if version is None:
|
||||
return None
|
||||
return version.revision.date_created
|
||||
|
||||
@property
|
||||
def last_edited_by(self):
|
||||
version = self.current_version
|
||||
if version is None:
|
||||
return None
|
||||
return version.revision.user
|
||||
|
||||
@property
|
||||
def current_version_id(self):
|
||||
version = self.current_version
|
||||
if version is None:
|
||||
return None
|
||||
return f"V{version.pk} | R{version.revision.pk}"
|
||||
|
||||
|
||||
class Person(models.Model, RevisionMixin):
|
||||
name = models.CharField(max_length=50)
|
||||
phone = models.CharField(max_length=15, blank=True, default='')
|
||||
@@ -172,7 +207,7 @@ class VatRate(models.Model, RevisionMixin):
|
||||
get_latest_by = 'start_at'
|
||||
|
||||
def __str__(self):
|
||||
return self.comment + " " + str(self.start_at) + " @ " + str(self.as_percent) + "%"
|
||||
return f"{self.comment} {self.start_at} @ {self.as_percent}%"
|
||||
|
||||
|
||||
class Venue(models.Model, RevisionMixin):
|
||||
@@ -312,10 +347,10 @@ class Event(models.Model, RevisionMixin):
|
||||
if self.pk:
|
||||
if self.is_rig:
|
||||
return str("N%05d" % self.pk)
|
||||
else:
|
||||
return self.pk
|
||||
else:
|
||||
return "????"
|
||||
|
||||
return self.pk
|
||||
|
||||
return "????"
|
||||
|
||||
# Calculated values
|
||||
"""
|
||||
@@ -440,7 +475,7 @@ class Event(models.Model, RevisionMixin):
|
||||
return reverse('event_detail', kwargs={'pk': self.pk})
|
||||
|
||||
def __str__(self):
|
||||
return "{}: {}".format(self.display_id, self.name)
|
||||
return f"{self.display_id}: {self.name}"
|
||||
|
||||
def clean(self):
|
||||
errdict = {}
|
||||
@@ -486,11 +521,11 @@ class EventItem(models.Model, RevisionMixin):
|
||||
ordering = ['order']
|
||||
|
||||
def __str__(self):
|
||||
return "{}.{}: {} | {}".format(self.event_id, self.order, self.event.name, self.name)
|
||||
return f"{self.event_id}.{self.order}: {self.event.name} | {self.name}"
|
||||
|
||||
@property
|
||||
def activity_feed_string(self):
|
||||
return str("item {}".format(self.name))
|
||||
return f"item {self.name}"
|
||||
|
||||
|
||||
@reversion.register
|
||||
@@ -508,7 +543,7 @@ class EventAuthorisation(models.Model, RevisionMixin):
|
||||
|
||||
@property
|
||||
def activity_feed_string(self):
|
||||
return "{} (requested by {})".format(self.event.display_id, self.sent_by.initials)
|
||||
return f"{self.event.display_id} (requested by {self.sent_by.initials})"
|
||||
|
||||
|
||||
class InvoiceManager(models.Manager):
|
||||
@@ -636,7 +671,6 @@ class RiskAssessment(models.Model, RevisionMixin):
|
||||
|
||||
# Power
|
||||
big_power = models.BooleanField(help_text="Does the event require larger power supplies than 13A or 16A single phase wall sockets, or draw more than 20A total current?")
|
||||
# If yes to the above two, you must answer...
|
||||
power_mic = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='power_mic', blank=True, null=True,
|
||||
verbose_name="Power MIC", on_delete=models.CASCADE, help_text="Who is the Power MIC? (if yes to the above question, this person <em>must</em> be a Power Technician or Power Supervisor)")
|
||||
outside = models.BooleanField(help_text="Is the event outdoors?")
|
||||
|
||||
@@ -38,7 +38,7 @@ class RigboardIndex(generic.TemplateView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# get super context
|
||||
context = super(RigboardIndex, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
# call out method to get current events
|
||||
context['events'] = models.Event.objects.current_events().select_related('riskassessment', 'invoice').prefetch_related('checklists')
|
||||
@@ -50,7 +50,7 @@ class WebCalendar(generic.TemplateView):
|
||||
template_name = 'calendar.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(WebCalendar, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['view'] = kwargs.get('view', '')
|
||||
context['date'] = kwargs.get('date', '')
|
||||
return context
|
||||
@@ -61,8 +61,8 @@ class EventDetail(generic.DetailView):
|
||||
model = models.Event
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventDetail, self).get_context_data(**kwargs)
|
||||
title = "{} | {}".format(self.object.display_id, self.object.name)
|
||||
context = super().get_context_data(**kwargs)
|
||||
title = f"{self.object.display_id} | {self.object.name}"
|
||||
if self.object.dry_hire:
|
||||
title += " <span class='badge badge-secondary'>Dry Hire</span>"
|
||||
context['page_title'] = title
|
||||
@@ -84,7 +84,7 @@ class EventCreate(generic.CreateView):
|
||||
template_name = 'event_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventCreate, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = "New Event"
|
||||
context['edit'] = True
|
||||
context['currentVAT'] = models.VatRate.objects.current_rate()
|
||||
@@ -110,8 +110,8 @@ class EventUpdate(generic.UpdateView):
|
||||
template_name = 'event_form.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventUpdate, self).get_context_data(**kwargs)
|
||||
context['page_title'] = "Event {}".format(self.object.display_id)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = f"Event {self.object.display_id}"
|
||||
context['edit'] = True
|
||||
|
||||
form = context['form']
|
||||
@@ -134,7 +134,7 @@ class EventUpdate(generic.UpdateView):
|
||||
if hasattr(self.object, 'authorised'):
|
||||
messages.warning(self.request,
|
||||
'This event has already been authorised by the client, any changes to the price will require reauthorisation.')
|
||||
return super(EventUpdate, self).render_to_response(context, **response_kwargs)
|
||||
return super().render_to_response(context, **response_kwargs)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy('event_detail', kwargs={'pk': self.object.pk})
|
||||
@@ -142,7 +142,7 @@ class EventUpdate(generic.UpdateView):
|
||||
|
||||
class EventDuplicate(EventUpdate):
|
||||
def get_object(self, queryset=None):
|
||||
old = super(EventDuplicate, self).get_object(queryset) # Get the object (the event you're duplicating)
|
||||
old = super().get_object(queryset) # Get the object (the event you're duplicating)
|
||||
new = copy.copy(old) # Make a copy of the object in memory
|
||||
new.based_on = old # Make the new event based on the old event
|
||||
new.purchase_order = None # Remove old PO
|
||||
@@ -167,8 +167,8 @@ class EventDuplicate(EventUpdate):
|
||||
return new
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventDuplicate, self).get_context_data(**kwargs)
|
||||
context['page_title'] = "Duplicate of Event {}".format(self.object.display_id)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = f"Duplicate of Event {self.object.display_id}"
|
||||
context["duplicate"] = True
|
||||
return context
|
||||
|
||||
@@ -210,8 +210,7 @@ class EventArchive(generic.ListView):
|
||||
paginate_by = 25
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# get super context
|
||||
context = super(EventArchive, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
context['start'] = self.request.GET.get('start', None)
|
||||
context['end'] = self.request.GET.get('end', datetime.date.today().strftime('%Y-%m-%d'))
|
||||
@@ -266,7 +265,7 @@ class EventArchive(generic.ListView):
|
||||
# Preselect related for efficiency
|
||||
qs.select_related('person', 'organisation', 'venue', 'mic')
|
||||
|
||||
if len(qs) == 0:
|
||||
if not qs.exists():
|
||||
messages.add_message(self.request, messages.WARNING, "No events have been found matching those criteria.")
|
||||
|
||||
return qs
|
||||
@@ -283,7 +282,7 @@ class EventAuthorise(generic.UpdateView):
|
||||
self.template_name = self.success_template
|
||||
messages.add_message(self.request, messages.SUCCESS,
|
||||
'Success! Your event has been authorised. ' +
|
||||
'You will also receive email confirmation to %s.' % self.object.email)
|
||||
f'You will also receive email confirmation to {self.object.email}.')
|
||||
return self.render_to_response(self.get_context_data())
|
||||
|
||||
@property
|
||||
@@ -297,10 +296,10 @@ class EventAuthorise(generic.UpdateView):
|
||||
return forms.InternalClientEventAuthorisationForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventAuthorise, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['event'] = self.event
|
||||
context['tos_url'] = settings.TERMS_OF_HIRE_URL
|
||||
context['page_title'] = "{}: {}".format(self.event.display_id, self.event.name)
|
||||
context['page_title'] = f"{self.event.display_id}: {self.event.name}"
|
||||
if self.event.dry_hire:
|
||||
context['page_title'] += ' <span class="badge badge-secondary align-top">Dry Hire</span>'
|
||||
context['preview'] = self.preview
|
||||
@@ -319,7 +318,7 @@ class EventAuthorise(generic.UpdateView):
|
||||
return super(EventAuthorise, self).get(request, *args, **kwargs)
|
||||
|
||||
def get_form(self, **kwargs):
|
||||
form = super(EventAuthorise, self).get_form(**kwargs)
|
||||
form = super().get_form(**kwargs)
|
||||
form.instance.event = self.event
|
||||
form.instance.email = self.request.email
|
||||
form.instance.sent_by = self.request.sent_by
|
||||
@@ -335,7 +334,7 @@ class EventAuthorise(generic.UpdateView):
|
||||
except (signing.BadSignature, AssertionError, KeyError, models.Profile.DoesNotExist):
|
||||
raise SuspiciousOperation(
|
||||
"This URL is invalid. Please ask your TEC contact for a new URL")
|
||||
return super(EventAuthorise, self).dispatch(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class EventAuthorisationRequest(generic.FormView, generic.detail.SingleObjectMixin):
|
||||
@@ -345,7 +344,7 @@ class EventAuthorisationRequest(generic.FormView, generic.detail.SingleObjectMix
|
||||
|
||||
@method_decorator(decorators.nottinghamtec_address_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(EventAuthorisationRequest, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def object(self):
|
||||
@@ -406,13 +405,13 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView):
|
||||
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
css = finders.find('css/email.css')
|
||||
response = super(EventAuthoriseRequestEmailPreview, self).render_to_response(context, **response_kwargs)
|
||||
response = super().render_to_response(context, **response_kwargs)
|
||||
assert isinstance(response, HttpResponse)
|
||||
response.content = premailer.Premailer(response.rendered_content, external_styles=css).transform()
|
||||
return response
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EventAuthoriseRequestEmailPreview, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['hmac'] = signing.dumps({
|
||||
'pk': self.object.pk,
|
||||
'email': self.request.GET.get('email', 'hello@world.test'),
|
||||
|
||||
BIN
RIGS/static/imgs/assets.jpg
Normal file
BIN
RIGS/static/imgs/assets.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
BIN
RIGS/static/imgs/rigs.jpg
Normal file
BIN
RIGS/static/imgs/rigs.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
BIN
RIGS/static/imgs/tappytaptap.gif
Normal file
BIN
RIGS/static/imgs/tappytaptap.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 MiB |
BIN
RIGS/static/imgs/training.jpg
Normal file
BIN
RIGS/static/imgs/training.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 852 KiB |
@@ -79,12 +79,12 @@
|
||||
});
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'item_modal.html' %}
|
||||
{% include 'partials/item_modal.html' %}
|
||||
<form class="itemised_form" role="form" method="POST">
|
||||
{% csrf_token %}
|
||||
<div class="row">
|
||||
@@ -338,7 +338,7 @@
|
||||
|
||||
<div class="form-group" data-toggle="tooltip" title="The purchase order number (for external clients)">
|
||||
<label for="{{ form.purchase_order.id_for_label }}"
|
||||
class="col-sm-4 col-form-label">{{ form.purchase_order.label }}</label>
|
||||
class="col-sm-4 col-fitem_tableorm-label">{{ form.purchase_order.label }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
{% render_field form.purchase_order class+="form-control" %}
|
||||
|
||||
@@ -5,18 +5,16 @@
|
||||
{% load nice_errors from filters %}
|
||||
|
||||
{% block css %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet" href="{% static 'css/selects.css' %}"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block preload_js %}
|
||||
{{ block.super }}
|
||||
<script src="{% static 'js/selects.js' %}"></script>
|
||||
<script src="{% static 'js/selects.js' %}" async></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ block.super }}
|
||||
<script src="{% static 'js/autocompleter.js' %}"></script>
|
||||
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||
|
||||
<script>
|
||||
function parseBool(str) {
|
||||
|
||||
@@ -284,11 +284,11 @@ def test_xframe_headers(admin_client, basic_event):
|
||||
|
||||
response = admin_client.get(event_url, follow=True)
|
||||
with pytest.raises(KeyError):
|
||||
response._headers["X-Frame-Options"]
|
||||
response.headers["X-Frame-Options"]
|
||||
|
||||
response = admin_client.get(login_url, follow=True)
|
||||
with pytest.raises(KeyError):
|
||||
response._headers["X-Frame-Options"]
|
||||
response.headers["X-Frame-Options"]
|
||||
|
||||
|
||||
def test_oembed(client, basic_event):
|
||||
|
||||
@@ -6,7 +6,7 @@ class PersonList(GenericListView):
|
||||
model = models.Person
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PersonList, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = "People"
|
||||
context['create'] = 'person_create'
|
||||
context['edit'] = 'person_update'
|
||||
@@ -19,7 +19,7 @@ class PersonDetail(GenericDetailView):
|
||||
model = models.Person
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PersonDetail, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['history_link'] = 'person_history'
|
||||
context['detail_link'] = 'person_detail'
|
||||
context['update_link'] = 'person_update'
|
||||
@@ -49,7 +49,7 @@ class OrganisationList(GenericListView):
|
||||
model = models.Organisation
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(OrganisationList, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['create'] = 'organisation_create'
|
||||
context['edit'] = 'organisation_update'
|
||||
context['can_edit'] = self.request.user.has_perm('RIGS.change_organisation')
|
||||
@@ -62,7 +62,7 @@ class OrganisationDetail(GenericDetailView):
|
||||
model = models.Organisation
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(OrganisationDetail, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['history_link'] = 'organisation_history'
|
||||
context['detail_link'] = 'organisation_detail'
|
||||
context['update_link'] = 'organisation_update'
|
||||
@@ -92,7 +92,7 @@ class VenueList(GenericListView):
|
||||
model = models.Venue
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(VenueList, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['create'] = 'venue_create'
|
||||
context['edit'] = 'venue_update'
|
||||
context['can_edit'] = self.request.user.has_perm('RIGS.change_venue')
|
||||
@@ -104,7 +104,7 @@ class VenueDetail(GenericDetailView):
|
||||
model = models.Venue
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(VenueDetail, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['history_link'] = 'venue_history'
|
||||
context['detail_link'] = 'venue_detail'
|
||||
context['update_link'] = 'venue_update'
|
||||
|
||||
Reference in New Issue
Block a user