mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Merge branch 'master' into revision-view
This commit is contained in:
4
PyRIGS/.slugignore
Normal file
4
PyRIGS/.slugignore
Normal file
@@ -0,0 +1,4 @@
|
||||
*.sqlite3
|
||||
*.scss
|
||||
*.md
|
||||
*.rb
|
||||
@@ -18,17 +18,21 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'gxhy(a#5mhp289_=6xx$7jh=eh$ymxg^ymc+di*0c*geiu3p_e'
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY') if os.environ.get('SECRET_KEY') else 'gxhy(a#5mhp289_=6xx$7jh=eh$ymxg^ymc+di*0c*geiu3p_e'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
DEBUG = bool(int(os.environ.get('DEBUG'))) if os.environ.get('DEBUG') else True
|
||||
|
||||
TEMPLATE_DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ALLOWED_HOSTS = ['pyrigs.nottinghamtec.co.uk', 'rigs.nottinghamtec.co.uk', 'pyrigs.herokuapp.com']
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
ADMINS = (
|
||||
('Tom Price', 'tomtom5152@gmail.com')
|
||||
)
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -44,6 +48,7 @@ INSTALLED_APPS = (
|
||||
'debug_toolbar',
|
||||
'registration',
|
||||
'reversion',
|
||||
'captcha',
|
||||
'widget_tweaks',
|
||||
)
|
||||
|
||||
@@ -112,13 +117,27 @@ LOGGING = {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'verbose'
|
||||
}
|
||||
},
|
||||
'mail_admins': {
|
||||
'class': 'django.utils.log.AdminEmailHandler',
|
||||
'level': 'ERROR',
|
||||
# But the emails are plain text by default - HTML is nicer
|
||||
'include_html': True,
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'RIGS': {
|
||||
# Again, default Django configuration to email unhandled exceptions
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
# Might as well log any errors anywhere else in Django
|
||||
'django': {
|
||||
'handlers': ['console'],
|
||||
'level': 'INFO',
|
||||
}
|
||||
'level': 'ERROR',
|
||||
'propagate': False,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +150,11 @@ LOGOUT_URL = '/user/logout'
|
||||
|
||||
ACCOUNT_ACTIVATION_DAYS = 7
|
||||
|
||||
# reCAPTCHA settings
|
||||
RECAPTCHA_PUBLIC_KEY = '6Le16gUTAAAAAO5f-6te_x0NjWmF65_h7saBI6Cg'
|
||||
RECAPTCHA_PRIVATE_KEY = '6Le16gUTAAAAAByo-ZxRRX3RKyoBngf7ms3dnoEW'
|
||||
NOCAPTCHA = True
|
||||
|
||||
# Email
|
||||
EMAILER_TEST = False
|
||||
if not DEBUG or EMAILER_TEST:
|
||||
@@ -187,4 +211,4 @@ TEMPLATE_DIRS = (
|
||||
|
||||
USE_GRAVATAR=True
|
||||
|
||||
TERMS_OF_HIRE_URL = "http://dev.nottinghamtec.co.uk/wp-content/uploads/2014/11/terms.pdf"
|
||||
TERMS_OF_HIRE_URL = "http://www.nottinghamtec.co.uk/terms.pdf"
|
||||
|
||||
@@ -3,7 +3,9 @@ from django import forms
|
||||
from django.utils import formats
|
||||
from django.conf import settings
|
||||
from django.core import serializers
|
||||
from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm
|
||||
from registration.forms import RegistrationFormUniqueEmail
|
||||
from captcha.fields import ReCaptchaField
|
||||
import simplejson
|
||||
|
||||
from RIGS import models
|
||||
@@ -14,6 +16,7 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
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()
|
||||
|
||||
def clean_initials(self):
|
||||
"""
|
||||
@@ -23,6 +26,13 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
raise forms.ValidationError("These initials are already in use. Please supply different initials.")
|
||||
return self.cleaned_data['initials']
|
||||
|
||||
# Login form
|
||||
class LoginForm(AuthenticationForm):
|
||||
captcha = ReCaptchaField(label='Captcha')
|
||||
|
||||
class PasswordReset(PasswordResetForm):
|
||||
captcha = ReCaptchaField(label='Captcha')
|
||||
|
||||
# Events Shit
|
||||
class EventForm(forms.ModelForm):
|
||||
datetime_input_formats = formats.get_format_lazy("DATETIME_INPUT_FORMATS") + settings.DATETIME_INPUT_FORMATS
|
||||
|
||||
@@ -25,7 +25,7 @@ function refreshUpdateHref(obj) {
|
||||
// console.log('Trying to disable');
|
||||
targetObject.attr('disabled', true);
|
||||
} else {
|
||||
// targetObject.attr('href', update_url);
|
||||
targetObject.attr('href', update_url);
|
||||
targetObject.attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,16 @@
|
||||
<link rel="stylesheet" href="{% static "css/ajax-bootstrap-select.css" %}"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block preload_js %}
|
||||
<script src="{% static "js/bootstrap-select.js" %}"></script>
|
||||
<script src="{% static "js/ajax-bootstrap-select.js" %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
||||
<script src="{% static "js/interaction.js" %}"></script>
|
||||
<script src="{% static "js/modal.js" %}"></script>
|
||||
|
||||
<script src="{% static "js/bootstrap-select.js" %}"></script>
|
||||
<script src="{% static "js/ajax-bootstrap-select.js" %}"></script>
|
||||
|
||||
<script src="{% static "js/autocompleter.js" %}"></script>
|
||||
|
||||
<script>
|
||||
@@ -422,6 +424,13 @@
|
||||
{% include "RIGS/item_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 text-right">
|
||||
<div class="btn-group btn-page">
|
||||
<button type="submit" class="btn btn-default" title="Save"><span
|
||||
class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@
|
||||
|
||||
<setFont name="OpenSans" size="9"/>
|
||||
<drawString x="137" y="760">Portland Building, University Park, Nottingham, NG7 2RD</drawString>
|
||||
<drawString x="137" y="746">Phone: (0115) 846 8720</drawString>
|
||||
<drawString x="137" y="732">www.nottinghamtec.co.uk</drawString>
|
||||
<drawString x="265" y="732">info@nottinghamtec.co.uk</drawString>
|
||||
<drawString x="137" y="746">www.nottinghamtec.co.uk</drawString>
|
||||
<drawString x="265" y="746">info@nottinghamtec.co.uk</drawString>
|
||||
<drawString x="137" y="732">Phone: (0115) 846 8720</drawString>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<keepTogether>
|
||||
<blockTable style="totalTable" colWidths="300,115,80">
|
||||
<tr>
|
||||
<td>VAT may be charged at the current rate date of event ({{ object.vat_rate.as_percent|floatformat:2 }}%)</td>
|
||||
<td></td>
|
||||
<td>Total (ex. VAT)</td>
|
||||
<td>£ {{ object.sum_total|floatformat:2 }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="panel">
|
||||
<div class="panel table-responsive">
|
||||
<table class="table table-hover" id="item-table" {% if edit %}data-orderurl="{#% url 'item_order' %#}"{% endif %}>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from RIGS import views, rigboard, finance, ical
|
||||
from RIGS import views, rigboard, finance, ical, forms
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from PyRIGS.decorators import permission_required_with_403
|
||||
@@ -14,6 +14,7 @@ urlpatterns = patterns('',
|
||||
url(r'^closemodal/$', views.CloseModal.as_view(), name='closemodal'),
|
||||
|
||||
url('^user/login/$', 'RIGS.views.login', name='login'),
|
||||
url(r'^user/password_reset/$', 'django.contrib.auth.views.password_reset', {'password_reset_form':forms.PasswordReset}),
|
||||
|
||||
# People
|
||||
url(r'^people/$', permission_required_with_403('RIGS.view_person')(views.PersonList.as_view()),
|
||||
|
||||
@@ -30,7 +30,7 @@ def login(request, **kwargs):
|
||||
else:
|
||||
from django.contrib.auth.views import login
|
||||
|
||||
return login(request)
|
||||
return login(request, authentication_form=forms.LoginForm)
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@@ -7,6 +7,7 @@ dj-database-url==0.3.0
|
||||
dj-static==0.0.6
|
||||
django-debug-toolbar==1.2.2
|
||||
django-ical==1.3
|
||||
django-recaptcha==1.0.4
|
||||
django-registration-redux==1.1
|
||||
django-reversion==1.8.5
|
||||
django-toolbelt==0.0.1
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
|
||||
<script src="//code.jquery.com/jquery-latest.min.js"></script>
|
||||
{% block preload_js %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -136,7 +137,6 @@
|
||||
|
||||
<div class="modal fade" id="modal"></div>
|
||||
|
||||
<script src="//code.jquery.com/jquery-latest.min.js"></script>
|
||||
<script>
|
||||
Date.prototype.getISOString = function () {
|
||||
var yyyy = this.getFullYear().toString();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% load url from future %}
|
||||
{% load widget_tweaks %}
|
||||
{% include 'form_errors.html' %}
|
||||
<div class="col-md-4 col-md-offset-4">
|
||||
<div class="col-sm-6 col-sm-offset-3 col-lg-4 col-lg-offset-4">
|
||||
|
||||
<form action="{% url 'login' %}" method="post" role="form">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
@@ -12,6 +12,12 @@
|
||||
<label for="{{ form.password.id_for_label }}">{{ form.password.label }}</label>
|
||||
{% render_field form.password class+="form-control" placeholder=form.password.label %}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="{{ form.captcha.id_for_label }}">{{ form.captcha.label }}</label>
|
||||
<div class="text-center">
|
||||
{{ form.captcha }}
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'registration_register' %}" class="btn">Register</a>
|
||||
<a href="{% url 'password_reset' %}" class="btn">Forgotten Password</a>
|
||||
<input type="submit" value="Login" class="btn btn-primary"/>
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
{% render_field form.email type="email" class+="form-control" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="pull-right">
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-10 col-md-8 col-md-offset-2">
|
||||
{{ form.captcha }}
|
||||
</div>
|
||||
<div class="col-sm-2 text-right">
|
||||
<input type="submit" value="Submit" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user