mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-03-18 09:55:57 +00:00
Compare commits
9 Commits
f3d9646607
...
optimisati
| Author | SHA1 | Date | |
|---|---|---|---|
|
d6c789d90a
|
|||
|
4fe7b874a4
|
|||
|
ac0425740e
|
|||
|
5382d8ae00
|
|||
|
08a55644c5
|
|||
|
b3939d8426
|
|||
|
f775cee7dd
|
|||
|
f5d875d153
|
|||
|
f88f418503
|
2
.github/workflows/django.yml
vendored
2
.github/workflows/django.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install pipenv
|
pip install pipenv
|
||||||
pipenv install -d
|
pipenv install -d
|
||||||
if: steps.pcache.outputs.cache-hit != 'true'
|
# if: steps.pcache.outputs.cache-hit != 'true'
|
||||||
- name: Cache Static Files
|
- name: Cache Static Files
|
||||||
id: static-cache
|
id: static-cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
|
|||||||
18
RIGS/migrations/0042_auto_20210302_1121.py
Normal file
18
RIGS/migrations/0042_auto_20210302_1121.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.1.7 on 2021-03-02 11:21
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('RIGS', '0041_auto_20210208_1603'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='phone',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=13),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -21,7 +21,7 @@ from reversion.models import Version
|
|||||||
|
|
||||||
class Profile(AbstractUser):
|
class Profile(AbstractUser):
|
||||||
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
initials = models.CharField(max_length=5, unique=True, null=True, blank=False)
|
||||||
phone = models.CharField(max_length=13, null=True, default='')
|
phone = models.CharField(max_length=13, blank=True, default='')
|
||||||
api_key = models.CharField(max_length=40, blank=True, editable=False, default='')
|
api_key = models.CharField(max_length=40, blank=True, editable=False, default='')
|
||||||
is_approved = models.BooleanField(default=False)
|
is_approved = models.BooleanField(default=False)
|
||||||
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
|
# Currently only populated by the admin approval email. TODO: Populate it each time we send any email, might need that...
|
||||||
@@ -707,7 +707,7 @@ class RiskAssessment(models.Model, RevisionMixin):
|
|||||||
]
|
]
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def fields(self):
|
def fieldz(self):
|
||||||
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -792,16 +792,16 @@ class EventChecklist(models.Model, RevisionMixin):
|
|||||||
|
|
||||||
inverted_fields = []
|
inverted_fields = []
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def fields(self):
|
|
||||||
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['event']
|
ordering = ['event']
|
||||||
permissions = [
|
permissions = [
|
||||||
('review_eventchecklist', 'Can review Event Checklists')
|
('review_eventchecklist', 'Can review Event Checklists')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def fieldz(self):
|
||||||
|
return [n.name for n in list(self._meta.get_fields()) if n.name != 'reviewed_at' and n.name != 'reviewed_by' and not n.is_relation and not n.auto_created]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def activity_feed_string(self):
|
def activity_feed_string(self):
|
||||||
return str(self.event)
|
return str(self.event)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<blockTable style="signatureTable" colWidths="50,120,60,120,35,110">
|
|
||||||
<tr>
|
|
||||||
<td>Signature</td>
|
|
||||||
<td></td>
|
|
||||||
<td>Print Name</td>
|
|
||||||
<td></td>
|
|
||||||
<td>Date</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<th scope="col">Event</th>
|
<th scope="col">Event</th>
|
||||||
{# mmm hax #}
|
{# mmm hax #}
|
||||||
{% if object_list.0 != None %}
|
{% if object_list.0 != None %}
|
||||||
{% for field in object_list.0.fields %}
|
{% for field in object_list.0.fieldz %}
|
||||||
<th scope="col">{{ object_list.0|verbose_name:field|title }}</th>
|
<th scope="col">{{ object_list.0|verbose_name:field|title }}</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<tr class="{% if object.reviewed_by %}table-success{%endif%}">
|
<tr class="{% if object.reviewed_by %}table-success{%endif%}">
|
||||||
{# General #}
|
{# General #}
|
||||||
<th scope="row"><a href="{% url 'event_detail' object.event.pk %}">{{ object.event }}</a></th>
|
<th scope="row"><a href="{% url 'event_detail' object.event.pk %}">{{ object.event }}</a></th>
|
||||||
{% for field in object_list.0.fields %}
|
{% for field in object_list.0.fieldz %}
|
||||||
<td>{{ object|get_field:field }}</td>
|
<td>{{ object|get_field:field }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{# Buttons #}
|
{# Buttons #}
|
||||||
|
|||||||
@@ -20,15 +20,7 @@
|
|||||||
|
|
||||||
{% if event.is_rig %}
|
{% if event.is_rig %}
|
||||||
<dt class="col-sm-6">Event MIC</dt>
|
<dt class="col-sm-6">Event MIC</dt>
|
||||||
<dd class="col-sm-6">
|
<dd class="col-sm-6">{% include 'partials/linked_name.html' with profile=event.mic %}</dd>
|
||||||
{% if event.mic and perms.RIGS.view_profile %}
|
|
||||||
<a href="{% url 'profile_detail' event.mic.pk %}" class="modal-href">
|
|
||||||
{{ event.mic.name }}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
{{ event.mic.name }}
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<dt class="col-sm-6">Status</dt>
|
<dt class="col-sm-6">Status</dt>
|
||||||
@@ -71,7 +63,7 @@
|
|||||||
|
|
||||||
{% if event.dry_hire %}
|
{% if event.dry_hire %}
|
||||||
<dt class="col-sm-6">Checked In By</dt>
|
<dt class="col-sm-6">Checked In By</dt>
|
||||||
<dd class="col-sm-6">{{ object.checked_in_by.name }}</dd>
|
<dd class="col-sm-6">{% include 'partials/linked_name.html' with profile=event.checked_in_by %}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if event.is_rig %}
|
{% if event.is_rig %}
|
||||||
|
|||||||
7
RIGS/templates/partials/linked_name.html
Normal file
7
RIGS/templates/partials/linked_name.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{% if profile and perms.RIGS.view_profile %}
|
||||||
|
<a href="{% url 'profile_detail' profile.pk %}" class="modal-href">
|
||||||
|
{{ profile.name }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{{ profile.name }}
|
||||||
|
{% endif %}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<th scope="row">{{ version.revision.date_created }}</th>
|
<th scope="row">{{ version.revision.date_created }}</th>
|
||||||
<td><a href="{{ version.changes.new.get_absolute_url }}">{{ version.changes.new.display_id|default:version.changes.new.pk }} | {{version.changes.new|to_class_name}}</a></td>
|
<td><a href="{{ version.changes.new.get_absolute_url }}">{{ version.changes.new.display_id|default:version.changes.new.pk }} | {{version.changes.new|to_class_name}}</a></td>
|
||||||
<td>{{ version.pk }}|{{ version.revision.pk }}</td>
|
<td>{{ version.pk }}|{{ version.revision.pk }}</td>
|
||||||
<td>{{ version.revision.user.name|default:"System" }}</td>
|
<td>{% include 'partials/linked_name.html' with profile=version.revision.user %}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if version.changes.old == None %}
|
{% if version.changes.old == None %}
|
||||||
Created {{version.changes.new|to_class_name}}
|
Created {{version.changes.new|to_class_name}}
|
||||||
|
|||||||
Reference in New Issue
Block a user