mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-03-02 10:08:24 +00:00
Cleanup
This commit is contained in:
@@ -34,6 +34,7 @@ class Index(generic.TemplateView):
|
||||
context['rig_count'] = models.Event.objects.rig_count()
|
||||
return context
|
||||
|
||||
|
||||
class SecureAPIRequest(generic.View):
|
||||
models = {
|
||||
'venue': models.Venue,
|
||||
|
||||
@@ -89,6 +89,7 @@ class EventChecklistDetail(generic.DetailView):
|
||||
model = models.EventChecklist
|
||||
template_name = 'event_checklist_detail.html'
|
||||
|
||||
|
||||
class EventChecklistEdit(generic.UpdateView):
|
||||
model = models.EventChecklist
|
||||
template_name = 'event_checklist_form.html'
|
||||
@@ -102,6 +103,7 @@ class EventChecklistEdit(generic.UpdateView):
|
||||
context['edit'] = True
|
||||
return context
|
||||
|
||||
|
||||
class EventChecklistCreate(generic.CreateView):
|
||||
model = models.EventChecklist
|
||||
template_name = 'event_checklist_form.html'
|
||||
|
||||
@@ -473,6 +473,7 @@ class Event(models.Model, RevisionMixin):
|
||||
self.full_clean()
|
||||
super(Event, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class EventItem(models.Model):
|
||||
event = models.ForeignKey('Event', related_name='items', blank=True, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=255)
|
||||
@@ -633,6 +634,7 @@ class RiskAssessment(models.Model, RevisionMixin):
|
||||
def __str__(self):
|
||||
return "%i - %s" % (self.pk, self.event)
|
||||
|
||||
|
||||
@reversion.register(follow=['vehicles', ])
|
||||
class EventChecklist(models.Model, RevisionMixin):
|
||||
event = models.OneToOneField('Event', on_delete=models.CASCADE)
|
||||
|
||||
@@ -142,6 +142,8 @@ def send_admin_awaiting_approval_email(user, request, **kwargs):
|
||||
user_activated.connect(send_admin_awaiting_approval_email)
|
||||
|
||||
# TODO Move
|
||||
|
||||
|
||||
def update_cache(sender, instance, created, **kwargs):
|
||||
cache.clear()
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ from functools import reduce
|
||||
|
||||
from PyRIGS.views import GenericListView
|
||||
|
||||
|
||||
class PersonList(GenericListView):
|
||||
template_name = 'person_list.html'
|
||||
model = models.Person
|
||||
|
||||
@@ -18,6 +18,7 @@ from versioning.versioning import RIGSVersion
|
||||
from django.views.decorators.cache import never_cache
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
|
||||
class VersionHistory(generic.ListView):
|
||||
model = RIGSVersion
|
||||
template_name = "version_history.html"
|
||||
@@ -43,12 +44,14 @@ class VersionHistory(generic.ListView):
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def get_models(app=None):
|
||||
models = filter(lambda item: not hasattr(item, 'reversion_hide'), reversion.get_registered_models())
|
||||
if app != None:
|
||||
if app is not None:
|
||||
models = filter(lambda item: item in apps.get_app_config(app).get_models(), models)
|
||||
return models
|
||||
|
||||
|
||||
class ActivityTable(generic.ListView):
|
||||
model = RIGSVersion
|
||||
template_name = "activity_table.html"
|
||||
@@ -67,6 +70,8 @@ class ActivityTable(generic.ListView):
|
||||
return context
|
||||
|
||||
# Appears on homepage
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch') # Disable browser based caching
|
||||
class ActivityFeed(generic.ListView):
|
||||
model = RIGSVersion
|
||||
|
||||
Reference in New Issue
Block a user