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