Compare commits

..

9 Commits
open ... misc

Author SHA1 Message Date
eab031b3cb Fix for events with no access time 2020-03-07 15:16:58 +00:00
d274ea4606 FIX: Prevent setting access time after start time
Will close #405
2020-03-03 20:04:02 +00:00
abf977b47e FIX: Allow null on nickname CharField
Allowing null is required on a unique CharField
2020-03-03 19:40:27 +00:00
a1eb237f94 pep eiiiiiiight :-| 2020-03-02 17:59:10 +00:00
805f573b7d Add nickname field to assets
So we can stop storing nicknames in the sodding serial number
2020-03-02 17:53:39 +00:00
2b0aa3e673 Merge branch 'master' into misc 2020-03-02 17:38:59 +00:00
4a4d4a5cf3 Add authorisation process for sign ups and allow access to EventDetail for basic users (#399)
* CHANGE: First pass at opening up RIGS #233

Whilst it makes it something of a misnomer, the intent is to make the 'view_event' perm a permission to view event details like client/price. I don't see the point in giving everyone 'view_event' and adding a new 'view_event_detail'...Open to arguments the other way.

* CHANGE: New user signups now require admin approval

Given that I intend to reveal much more data to new users this seems necessary...

* CHORE: Fix CI

* FIX: Legacy Profiles are now auto-approved correctly

* Add testing of approval mechanism

This fixes the other functional tests failing because the user cannot login without being approved.

* Superusers bypass approval check

This should fix the remainder of the tests

* Prevent unapproved users logging in through embeds

Test suite doing its job...!

* FIX: Require login on events and event embeds again

Little too far to the open side there Arona... Whooooooops!

* FIX: Use has_oembed decorator for events

* FIX: Re-prevent basic seeing reversion

This is to prevent financials/client data leaking when changed. Hopefully can show them a filtered version in future.

* FIX: Remove mitigation for #264

Someone quietly fixed it, it appears

* FEAT: Add admin email notif when an account is activated and awaiting approval

No async or time-since shenanigans yet!

* FIX: Whoops, undo accidental whitespace change

* FEAT: Add a fifteen min cooldown between emails to admins

Probably not the right way to go about it...but it does work!

TODO: How to handle cooldown-emailing shared mailbox addresses?

* FIX: Remove event modal history deadlink for basic users

Also removes some links on the RIGS homepage that will deadlink for them

* FIX: Wrong perms syntax for history pages

* CHORE: Squash migrations

* FIX: Use a setting for cooldown

* FIX: Minor code improvements
2020-02-29 11:34:50 +00:00
0d9acc413b FIX: Set duplicated event status to provisional
Closes #398
2020-02-19 13:39:48 +00:00
6dffaa4f21 Update README.md 2020-02-18 12:17:23 +00:00
6 changed files with 32 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
# TEC PA & Lighting - PyRIGS #
[![Build Status](https://travis-ci.org/nottinghamtec/PyRIGS.svg?branch=develop)](https://travis-ci.org/nottinghamtec/PyRIGS)
[![Coverage Status](https://coveralls.io/repos/github/nottinghamtec/PyRIGS/badge.svg?branch=develop)](https://coveralls.io/github/nottinghamtec/PyRIGS)
[![Coverage Status](https://coveralls.io/repos/github/nottinghamtec/PyRIGS/badge.svg)](https://coveralls.io/github/nottinghamtec/PyRIGS)
Welcome to TEC PA & Lightings PyRIGS program. This is a reimplementation of the existing Rig Information Gathering System (RIGS) that was developed using Ruby on Rails.

View File

@@ -486,6 +486,10 @@ class Event(models.Model, RevisionMixin):
if startEndSameDay and hasStartAndEnd and self.start_time > self.end_time:
raise ValidationError('Unless you\'ve invented time travel, the event can\'t finish before it has started.')
accessAndStartSameDay = self.access_at is not None and self.start_date == self.access_at.date()
if self.access_at.date() > self.start_date or (accessAndStartSameDay and self.access_at.time() > self.start_time):
raise ValidationError('Regardless of what some clients might think, access time cannot be after the event has started.')
def save(self, *args, **kwargs):
"""Call :meth:`full_clean` before saving."""
self.full_clean()

View File

@@ -162,6 +162,7 @@ class EventDuplicate(EventUpdate):
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
new.status = new.PROVISIONAL # Return status to provisional
# Clear checked in by if it's a dry hire
if new.dry_hire is True:

View File

@@ -0,0 +1,18 @@
# Generated by Django 2.0.13 on 2020-03-03 19:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0010_auto_20200207_1737'),
]
operations = [
migrations.AddField(
model_name='asset',
name='nickname',
field=models.CharField(blank=True, max_length=20, null=True, unique=True),
),
]

View File

@@ -82,6 +82,7 @@ class Asset(models.Model, RevisionMixin):
category = models.ForeignKey(to=AssetCategory, on_delete=models.CASCADE)
status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE)
serial_number = models.CharField(max_length=150, blank=True)
nickname = models.CharField(max_length=20, blank=True, null=True, unique=True) # Null = true required because of the unique constraint
purchased_from = models.ForeignKey(to=Supplier, on_delete=models.CASCADE, blank=True, null=True, related_name="assets")
date_acquired = models.DateField()
date_sold = models.DateField(blank=True, null=True)

View File

@@ -32,6 +32,10 @@
<label for="{{ form.serial_number.id_for_label }}">Serial Number</label>
{% render_field form.serial_number|add_class:'form-control' value=object.serial_number %}
</div>
<div class="form-group">
<label for="{{ form.nickname.id_for_label }}">Nickname</label>
{% render_field form.nickname|add_class:'form-control' value=object.nickname %}
</div>
<!---TODO: Lower default number of lines in comments box-->
<div class="form-group">
<label for="{{ form.comments.id_for_label }}">Comments</label>
@@ -53,6 +57,9 @@
<dt>Serial Number</dt>
<dd>{{ object.serial_number|default:'-' }}</dd>
<dt>Nickname</dt>
<dd>{{ object.nickname|default:'-' }}</dd>
<dt>Comments</dt>
<dd style="overflow-wrap: break-word;">{{ object.comments|default:'-'|linebreaksbr }}</dd>
{% endif %}