mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Merge branch 'master' into duplicate-event
This commit is contained in:
@@ -55,6 +55,7 @@ class InvoicePrint(generic.View):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'invoice':invoice,
|
'invoice':invoice,
|
||||||
|
'current_user':request.user,
|
||||||
})
|
})
|
||||||
|
|
||||||
rml = template.render(context)
|
rml = template.render(context)
|
||||||
|
|||||||
@@ -12,16 +12,11 @@ from RIGS import models
|
|||||||
|
|
||||||
#Registration
|
#Registration
|
||||||
class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||||
username = forms.CharField(required=True, max_length=30)
|
|
||||||
first_name = forms.CharField(required=False, max_length=50)
|
|
||||||
last_name = forms.CharField(required=False, max_length=50)
|
|
||||||
initials = forms.CharField(required=True, max_length=5)
|
|
||||||
phone = forms.CharField(required=False, max_length=13)
|
|
||||||
captcha = ReCaptchaField()
|
captcha = ReCaptchaField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Profile
|
model = models.Profile
|
||||||
fields = ('username','first_name','last_name','initials','phone')
|
fields = ('username','email','first_name','last_name','initials','phone')
|
||||||
|
|
||||||
def clean_initials(self):
|
def clean_initials(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -97,6 +97,9 @@ class CalendarICS(ICalFeed):
|
|||||||
return item.earliest_time
|
return item.earliest_time
|
||||||
|
|
||||||
def item_end_datetime(self, item):
|
def item_end_datetime(self, item):
|
||||||
|
if type(item.latest_time) is datetime.date: # Ical end_datetime is non-inclusive, so add a day
|
||||||
|
return item.latest_time + datetime.timedelta(days=1)
|
||||||
|
|
||||||
return item.latest_time
|
return item.latest_time
|
||||||
|
|
||||||
def item_location(self,item):
|
def item_location(self,item):
|
||||||
|
|||||||
@@ -71,6 +71,15 @@ class RevisionMixin(object):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_version_id(self):
|
||||||
|
versions = reversion.get_for_object(self)
|
||||||
|
if versions:
|
||||||
|
version = reversion.get_for_object(self)[0]
|
||||||
|
return "V{0} | R{1}".format(version.pk,version.revision.pk)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
@reversion.register
|
@reversion.register
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Person(models.Model, RevisionMixin):
|
class Person(models.Model, RevisionMixin):
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ class EventPrint(generic.View):
|
|||||||
'bold': 'RIGS/static/fonts/OPENSANS-BOLD.TTF',
|
'bold': 'RIGS/static/fonts/OPENSANS-BOLD.TTF',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'copy':copy
|
'copy':copy,
|
||||||
|
'current_user':request.user,
|
||||||
})
|
})
|
||||||
|
|
||||||
# context['copy'] = copy # this is the way to do it once we upgrade to Django 1.8.3
|
# context['copy'] = copy # this is the way to do it once we upgrade to Django 1.8.3
|
||||||
|
|||||||
@@ -56,11 +56,14 @@
|
|||||||
'non-rig': '#5bc0de'
|
'non-rig': '#5bc0de'
|
||||||
};
|
};
|
||||||
$(doc).each(function() {
|
$(doc).each(function() {
|
||||||
|
end = $(this).attr('latest')
|
||||||
|
if(end.indexOf("T") < 0){ //If latest does not contain a time
|
||||||
|
end = moment(end).add(1, 'days') //End date is non-inclusive, so add a day
|
||||||
|
}
|
||||||
|
|
||||||
thisEvent = {
|
thisEvent = {
|
||||||
'start': $(this).attr('earliest'),
|
'start': $(this).attr('earliest'),
|
||||||
'end': $(this).attr('latest'),
|
'end': end,
|
||||||
'className': 'modal-href',
|
'className': 'modal-href',
|
||||||
'title': $(this).attr('title'),
|
'title': $(this).attr('title'),
|
||||||
'url': $(this).attr('url')
|
'url': $(this).attr('url')
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
||||||
<script src="{% static "js/interaction.js" %}"></script>
|
<script src="{% static "js/interaction.js" %}"></script>
|
||||||
<script src="{% static "js/modal.js" %}"></script>
|
<script src="{% static "js/modal.js" %}"></script>
|
||||||
|
<script src="{% static "js/tooltip.js" %}"></script>
|
||||||
|
|
||||||
<script src="{% static "js/autocompleter.js" %}"></script>
|
<script src="{% static "js/autocompleter.js" %}"></script>
|
||||||
|
|
||||||
@@ -110,6 +111,9 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
setupItemTable($("#{{ form.items_json.id_for_label }}").val());
|
setupItemTable($("#{{ form.items_json.id_for_label }}").val());
|
||||||
});
|
});
|
||||||
|
$(function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -162,7 +166,7 @@
|
|||||||
<div class="panel panel-default form-hws form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
<div class="panel panel-default form-hws form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
||||||
<div class="panel-heading">Contact Details</div>
|
<div class="panel-heading">Contact Details</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The main contact for the event, can be left blank if purely an organisation">
|
||||||
<label for="{{ form.person.id_for_label }}"
|
<label for="{{ form.person.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.person.label }}</label>
|
class="col-sm-4 control-label">{{ form.person.label }}</label>
|
||||||
|
|
||||||
@@ -189,14 +193,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The client organisation, leave blank if client is an individual">
|
||||||
<label for="{{ form.organisation.id_for_label }}"
|
<label for="{{ form.organisation.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.organisation.label }}</label>
|
class="col-sm-4 control-label">{{ form.organisation.label }}</label>
|
||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-9 col-md-7 col-lg-8">
|
<div class="col-sm-9 col-md-7 col-lg-8">
|
||||||
<select id="{{ form.organisation.id_for_label }}" name="{{ form.organisation.name }}" class="form-control selectpicker" data-live-search="true" data-sourceurl="{% url 'api_secure' model='organisation' %}">
|
<select id="{{ form.organisation.id_for_label }}" name="{{ form.organisation.name }}" class="form-control selectpicker" data-live-search="true" data-sourceurl="{% url 'api_secure' model='organisation' %}" >
|
||||||
{% if organisation %}
|
{% if organisation %}
|
||||||
<option value="{{form.organisation.value}}" selected="selected" data-update_url="{% url 'organisation_update' form.organisation.value %}">{{ organisation }}</option>
|
<option value="{{form.organisation.value}}" selected="selected" data-update_url="{% url 'organisation_update' form.organisation.value %}">{{ organisation }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -221,7 +225,7 @@
|
|||||||
<div class="panel panel-default form-hws form-non_rig">
|
<div class="panel panel-default form-hws form-non_rig">
|
||||||
<div class="panel-heading">Event Description</div>
|
<div class="panel-heading">Event Description</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="A short description of the event, shown on rigboard and on paperwork">
|
||||||
<label for="{{ form.description.id_for_label }}"
|
<label for="{{ form.description.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.description.label }}</label>
|
class="col-sm-4 control-label">{{ form.description.label }}</label>
|
||||||
|
|
||||||
@@ -240,7 +244,7 @@
|
|||||||
<div class="panel-heading">Event Details</div>
|
<div class="panel-heading">Event Details</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="form-hws">
|
<div id="form-hws">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="Name of the event, displays on rigboard and on paperwork">
|
||||||
<label for="{{ form.name.id_for_label }}"
|
<label for="{{ form.name.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.name.label }}</label>
|
class="col-sm-4 control-label">{{ form.name.label }}</label>
|
||||||
|
|
||||||
@@ -248,7 +252,7 @@
|
|||||||
{% render_field form.name class+="form-control" %}
|
{% render_field form.name class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The venue for the rig, leave blank if unknown (e.g. for a dry hire)">
|
||||||
<label for="{{ form.venue.id_for_label }}"
|
<label for="{{ form.venue.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.venue.label }}</label>
|
class="col-sm-4 control-label">{{ form.venue.label }}</label>
|
||||||
|
|
||||||
@@ -281,10 +285,10 @@
|
|||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-7">
|
<div class="col-sm-12 col-md-7" data-toggle="tooltip" title="Start date for event, required">
|
||||||
{% render_field form.start_date type="date" class+="form-control" %}
|
{% render_field form.start_date type="date" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-md-5">
|
<div class="col-sm-12 col-md-5" data-toggle="tooltip" title="Start time of event, can be left blank">
|
||||||
{% render_field form.start_time type="time" class+="form-control" %}
|
{% render_field form.start_time type="time" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -296,10 +300,10 @@
|
|||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-7">
|
<div class="col-sm-12 col-md-7" data-toggle="tooltip" title="End date of event, leave blank if unknown or same as start date">
|
||||||
{% render_field form.end_date type="date" class+="form-control" %}
|
{% render_field form.end_date type="date" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-md-5">
|
<div class="col-sm-12 col-md-5" data-toggle="tooltip" title="End time of event, leave blank if unknown">
|
||||||
{% render_field form.end_time type="time" class+="form-control" %}
|
{% render_field form.end_time type="time" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -317,7 +321,7 @@
|
|||||||
|
|
||||||
{# Rig only information #}
|
{# Rig only information #}
|
||||||
<div class="form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
<div class="form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The date/time at which TEC have access to the venue">
|
||||||
<label for="{{ form.access_at.id_for_label }}"
|
<label for="{{ form.access_at.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.access_at.label }}</label>
|
class="col-sm-4 control-label">{{ form.access_at.label }}</label>
|
||||||
|
|
||||||
@@ -325,7 +329,7 @@
|
|||||||
{% render_field form.access_at type="datetime-local" class+="form-control" %}
|
{% render_field form.access_at type="datetime-local" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The date/time at which crew should meet for this event">
|
||||||
<label for="{{ form.meet_at.id_for_label }}"
|
<label for="{{ form.meet_at.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.meet_at.label }}</label>
|
class="col-sm-4 control-label">{{ form.meet_at.label }}</label>
|
||||||
|
|
||||||
@@ -336,7 +340,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-4 col-sm-8">
|
<div class="col-sm-offset-4 col-sm-8">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label data-toggle="tooltip" title="Mark this event as a dry-hire, so it needs to be checked in at the end">
|
||||||
{% render_field form.dry_hire %}{{ form.dry_hire.label }}
|
{% render_field form.dry_hire %}{{ form.dry_hire.label }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -345,7 +349,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{# Status is needed on all events types and it looks good here in the form #}
|
{# Status is needed on all events types and it looks good here in the form #}
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The current status of the event. Only mark as booked once paperwork is received">
|
||||||
<label for="{{ form.status.id_for_label }}"
|
<label for="{{ form.status.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.status.label }}</label>
|
class="col-sm-4 control-label">{{ form.status.label }}</label>
|
||||||
|
|
||||||
@@ -355,7 +359,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
<div class="form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The Member in Charge of this event">
|
||||||
<label for="{{ form.mic.id_for_label }}"
|
<label for="{{ form.mic.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.mic.label }}</label>
|
class="col-sm-4 control-label">{{ form.mic.label }}</label>
|
||||||
|
|
||||||
@@ -369,7 +373,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if object.dry_hire %}
|
{% if object.dry_hire %}
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The person who checked-in this dry hire">
|
||||||
<label for="{{ form.checked_in_by.id_for_label }}"
|
<label for="{{ form.checked_in_by.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.checked_in_by.label }}</label>
|
class="col-sm-4 control-label">{{ form.checked_in_by.label }}</label>
|
||||||
|
|
||||||
@@ -383,7 +387,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The student ID of the client who collected the dry-hire">
|
||||||
<label for="{{ form.collector.id_for_label }}"
|
<label for="{{ form.collector.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.collector.label }}</label>
|
class="col-sm-4 control-label">{{ form.collector.label }}</label>
|
||||||
|
|
||||||
@@ -391,7 +395,7 @@
|
|||||||
{% render_field form.collector class+="form-control" %}
|
{% render_field form.collector class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="The purchase order number (for external clients)">
|
||||||
<label for="{{ form.purchase_order.id_for_label }}"
|
<label for="{{ form.purchase_order.id_for_label }}"
|
||||||
class="col-sm-4 control-label">{{ form.purchase_order.label }}</label>
|
class="col-sm-4 control-label">{{ form.purchase_order.label }}</label>
|
||||||
|
|
||||||
@@ -419,7 +423,7 @@
|
|||||||
<div class="panel panel-default form-hws form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
<div class="panel panel-default form-hws form-is_rig {% if object.pk and not object.is_rig %}hidden{% endif %}">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="form-group">
|
<div class="form-group" data-toggle="tooltip" title="Notes on the event. This is only visible to keyholders, and is not displayed on the paperwork">
|
||||||
<label for="{{ form.notes.id_for_label }}">{{ form.notes.label }}</label>
|
<label for="{{ form.notes.id_for_label }}">{{ form.notes.label }}</label>
|
||||||
{% render_field form.notes class+="form-control" %}
|
{% render_field form.notes class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -102,6 +102,8 @@
|
|||||||
<setFont name="OpenSans" size="10" />
|
<setFont name="OpenSans" size="10" />
|
||||||
{% if not invoice %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
|
{% if not invoice %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
|
||||||
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
||||||
|
<setFont name="OpenSans" size="7" />
|
||||||
|
<drawCenteredString x="302.5" y="26">[Paperwork generated by {{current_user.name}} | {% now "d/m/Y H:i" %} | {{object.current_version_id}}]</drawCenteredString>
|
||||||
</pageGraphics>
|
</pageGraphics>
|
||||||
|
|
||||||
<frame id="main" x1="50" y1="65" width="495" height="645"/>
|
<frame id="main" x1="50" y1="65" width="495" height="645"/>
|
||||||
@@ -115,6 +117,8 @@
|
|||||||
<setFont name="OpenSans" size="10"/>
|
<setFont name="OpenSans" size="10"/>
|
||||||
{% if not invoice %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
|
{% if not invoice %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
|
||||||
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
|
||||||
|
<setFont name="OpenSans" size="7" />
|
||||||
|
<drawCenteredString x="302.5" y="26">[Paperwork generated by {{current_user.name}} | {% now "d/m/Y H:i" %} | {{object.current_version_id}}]</drawCenteredString>
|
||||||
</pageGraphics>
|
</pageGraphics>
|
||||||
<frame id="main" x1="50" y1="65" width="495" height="727"/>
|
<frame id="main" x1="50" y1="65" width="495" height="727"/>
|
||||||
</pageTemplate>
|
</pageTemplate>
|
||||||
|
|||||||
@@ -134,6 +134,15 @@ class UserRegistrationTest(LiveServerTestCase):
|
|||||||
udd = self.browser.find_element_by_class_name('navbar').text
|
udd = self.browser.find_element_by_class_name('navbar').text
|
||||||
self.assertIn('Hi John', udd)
|
self.assertIn('Hi John', udd)
|
||||||
|
|
||||||
|
# Check all the data actually got saved
|
||||||
|
profileObject = models.Profile.objects.all()[0]
|
||||||
|
self.assertEqual(profileObject.username, 'TestUsername')
|
||||||
|
self.assertEqual(profileObject.first_name, 'John')
|
||||||
|
self.assertEqual(profileObject.last_name, 'Smith')
|
||||||
|
self.assertEqual(profileObject.initials, 'JS')
|
||||||
|
self.assertEqual(profileObject.phone, '0123456789')
|
||||||
|
self.assertEqual(profileObject.email, 'test@example.com')
|
||||||
|
|
||||||
# All is well
|
# All is well
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user