mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-24 00:42:17 +00:00
Combine client authorisation information in rig detail (#373)
* Combine client authorisation information in rig detail * Fix stuff for CI pep8 compliance migration
This commit is contained in:
@@ -39,6 +39,7 @@ class EmbeddedAuthenticationForm(AuthenticationForm):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['username'].widget.attrs.pop('autofocus', None)
|
self.fields['username'].widget.attrs.pop('autofocus', None)
|
||||||
|
|
||||||
|
|
||||||
class PasswordReset(PasswordResetForm):
|
class PasswordReset(PasswordResetForm):
|
||||||
captcha = ReCaptchaField(label='Captcha')
|
captcha = ReCaptchaField(label='Captcha')
|
||||||
|
|
||||||
|
|||||||
18
RIGS/migrations/0035_auto_20191124_1319.py
Normal file
18
RIGS/migrations/0035_auto_20191124_1319.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.0.13 on 2019-11-24 13:19
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('RIGS', '0034_event_risk_assessment_edit_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='event',
|
||||||
|
name='risk_assessment_edit_url',
|
||||||
|
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='risk assessment'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -83,6 +83,7 @@ class EventEmbed(EventDetail):
|
|||||||
|
|
||||||
class EventRA(generic.base.RedirectView):
|
class EventRA(generic.base.RedirectView):
|
||||||
permanent = False
|
permanent = False
|
||||||
|
|
||||||
def get_redirect_url(self, *args, **kwargs):
|
def get_redirect_url(self, *args, **kwargs):
|
||||||
event = get_object_or_404(models.Event, pk=kwargs['pk'])
|
event = get_object_or_404(models.Event, pk=kwargs['pk'])
|
||||||
|
|
||||||
@@ -406,6 +407,7 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView):
|
|||||||
context['to_name'] = self.request.GET.get('to_name', None)
|
context['to_name'] = self.request.GET.get('to_name', None)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(csrf_exempt, name='dispatch')
|
@method_decorator(csrf_exempt, name='dispatch')
|
||||||
class LogRiskAssessment(generic.View):
|
class LogRiskAssessment(generic.View):
|
||||||
http_method_names = ["post"]
|
http_method_names = ["post"]
|
||||||
|
|||||||
@@ -70,39 +70,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if event.is_rig and event.internal %}
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">Client Authorisation</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<dl class="dl-horizontal">
|
|
||||||
<dt>Authorised</dt>
|
|
||||||
<dd>{{ object.authorised|yesno:"Yes,No" }}</dd>
|
|
||||||
|
|
||||||
<dt>Authorised by</dt>
|
|
||||||
<dd>
|
|
||||||
{% if object.authorisation %}
|
|
||||||
{{ object.authorisation.name }}
|
|
||||||
(<a href="mailto:{{ object.authorisation.email }}">{{ object.authorisation.email }}</a>)
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt>Authorised at</dt>
|
|
||||||
<dd>{{ object.authorisation.last_edited_at }}</dd>
|
|
||||||
|
|
||||||
<dt>Authorised amount</dt>
|
|
||||||
<dd>
|
|
||||||
{% if object.authorisation %}
|
|
||||||
£ {{ object.authorisation.amount|floatformat:"2" }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt>Requested by</dt>
|
|
||||||
<dd>{{ object.authorisation.sent_by }}</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="col-sm-12 {% if event.is_rig %}col-md-6 col-lg-7{% endif %}">
|
<div class="col-sm-12 {% if event.is_rig %}col-md-6 col-lg-7{% endif %}">
|
||||||
@@ -180,31 +147,63 @@
|
|||||||
<dd>{{ object.collector }}</dd>
|
<dd>{{ object.collector }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if event.is_rig %}
|
{% if event.is_rig and not event.internal %}
|
||||||
<dd> </dd>
|
<dd> </dd>
|
||||||
|
<dt>PO</dt>
|
||||||
{% if object.internal %}
|
<dd>{{ object.purchase_order }}</dd>
|
||||||
<dt>Authorisation Request</dt>
|
|
||||||
<dd>{{ object.auth_request_to|yesno:"Yes,No" }}</dd>
|
|
||||||
|
|
||||||
<dt>By</dt>
|
|
||||||
<dd>{{ object.auth_request_by }}</dd>
|
|
||||||
|
|
||||||
<dt>At</dt>
|
|
||||||
<dd>{{ object.auth_request_at|date:"D d M Y H:i"|default:"" }}</dd>
|
|
||||||
|
|
||||||
<dt>To</dt>
|
|
||||||
<dd>{{ object.auth_request_to }}</dd>
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<dt>PO</dt>
|
|
||||||
<dd>{{ object.purchase_order }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if event.is_rig and event.internal %}
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Client Authorisation</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<dl class="dl-horizontal col-sm-6">
|
||||||
|
<dt>Authorisation Request</dt>
|
||||||
|
<dd>{{ object.auth_request_to|yesno:"Yes,No" }}</dd>
|
||||||
|
|
||||||
|
<dt>By</dt>
|
||||||
|
<dd>{{ object.auth_request_by }}</dd>
|
||||||
|
|
||||||
|
<dt>At</dt>
|
||||||
|
<dd>{{ object.auth_request_at|date:"D d M Y H:i"|default:"" }}</dd>
|
||||||
|
|
||||||
|
<dt>To</dt>
|
||||||
|
<dd>{{ object.auth_request_to }}</dd>
|
||||||
|
</dl>
|
||||||
|
<dd class="visible-xs"> </dd>
|
||||||
|
<dl class="dl-horizontal col-sm-6">
|
||||||
|
<dt>Authorised</dt>
|
||||||
|
<dd>{{ object.authorised|yesno:"Yes,No" }}</dd>
|
||||||
|
|
||||||
|
<dt>Authorised by</dt>
|
||||||
|
<dd>
|
||||||
|
{% if object.authorisation %}
|
||||||
|
{{ object.authorisation.name }}
|
||||||
|
(<a href="mailto:{{ object.authorisation.email }}">{{ object.authorisation.email }}</a>)
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt>Authorised at</dt>
|
||||||
|
<dd>{{ object.authorisation.last_edited_at }}</dd>
|
||||||
|
|
||||||
|
<dt>Authorised amount</dt>
|
||||||
|
<dd>
|
||||||
|
{% if object.authorisation %}
|
||||||
|
£ {{ object.authorisation.amount|floatformat:"2" }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt>Requested by</dt>
|
||||||
|
<dd>{{ object.authorisation.sent_by }}</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{% endif %}
|
||||||
{% if not request.is_ajax %}
|
{% if not request.is_ajax %}
|
||||||
<div class="col-sm-12 text-right">
|
<div class="col-sm-12 text-right">
|
||||||
{% include 'RIGS/event_detail_buttons.html' %}
|
{% include 'RIGS/event_detail_buttons.html' %}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ def login_embed(request, **kwargs):
|
|||||||
messages.warning(request, 'Cookies do not seem to be enabled. Try logging in using a new tab.')
|
messages.warning(request, 'Cookies do not seem to be enabled. Try logging in using a new tab.')
|
||||||
request.method = 'GET' # Render the page without trying to login
|
request.method = 'GET' # Render the page without trying to login
|
||||||
|
|
||||||
return login(request, template_name="registration/login_embed.html", authentication_form=forms.EmbeddedAuthenticationForm)
|
return login(request, template_name="registration/login_embed.html", authentication_form=forms.EmbeddedAuthenticationForm)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user