Compare commits

...

8 Commits

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
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 # # TEC PA & Lighting - PyRIGS #
[![Build Status](https://travis-ci.org/nottinghamtec/PyRIGS.svg?branch=develop)](https://travis-ci.org/nottinghamtec/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. 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: 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.') 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): def save(self, *args, **kwargs):
"""Call :meth:`full_clean` before saving.""" """Call :meth:`full_clean` before saving."""
self.full_clean() 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 = 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.based_on = old # Make the new event based on the old event
new.purchase_order = None # Remove old PO 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 # Clear checked in by if it's a dry hire
if new.dry_hire is True: 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) category = models.ForeignKey(to=AssetCategory, on_delete=models.CASCADE)
status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE) status = models.ForeignKey(to=AssetStatus, on_delete=models.CASCADE)
serial_number = models.CharField(max_length=150, blank=True) 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") purchased_from = models.ForeignKey(to=Supplier, on_delete=models.CASCADE, blank=True, null=True, related_name="assets")
date_acquired = models.DateField() date_acquired = models.DateField()
date_sold = models.DateField(blank=True, null=True) 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> <label for="{{ form.serial_number.id_for_label }}">Serial Number</label>
{% render_field form.serial_number|add_class:'form-control' value=object.serial_number %} {% render_field form.serial_number|add_class:'form-control' value=object.serial_number %}
</div> </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--> <!---TODO: Lower default number of lines in comments box-->
<div class="form-group"> <div class="form-group">
<label for="{{ form.comments.id_for_label }}">Comments</label> <label for="{{ form.comments.id_for_label }}">Comments</label>
@@ -53,6 +57,9 @@
<dt>Serial Number</dt> <dt>Serial Number</dt>
<dd>{{ object.serial_number|default:'-' }}</dd> <dd>{{ object.serial_number|default:'-' }}</dd>
<dt>Nickname</dt>
<dd>{{ object.nickname|default:'-' }}</dd>
<dt>Comments</dt> <dt>Comments</dt>
<dd style="overflow-wrap: break-word;">{{ object.comments|default:'-'|linebreaksbr }}</dd> <dd style="overflow-wrap: break-word;">{{ object.comments|default:'-'|linebreaksbr }}</dd>
{% endif %} {% endif %}