mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fix various minor issues (#545)
* Add absolute URL to power tests * Update to target Python 3.10 * Return user to current page when clicking 'mark reviewed' * Add units to power test record detail and form I'm a bad scientist (coz I'm an engineer) * Allow a higher value in PSSC fields * Default venue to event venue in EC/PT * Fix population of initial venue values for EC/PT * Add link to create power test from EC detail * Do not set power plan field to required on RA "This might be a problem if the risk assessment is being done by one person and the power plan by another." * Default power MIC to MIC * Implement some suggestions from the Doctor * Prevent checking in to cancelled events and dry hires Will close #539 * Exclude dry hires from H&S overview list * Add "ex VAT" tooltips to asset purchase price and replacement cost * Automagically clear and focus ID field when audit modal closes Closes #533 * Delete unused things * Allow two decimal places in cable length, show training item IDs in selectpicker Will close #540 * Fix #524 500 Error when viewing qualification list for items nobody is qualified in * Update README.md * Add a guard against nulls in recent changes Maybe fixes #537 I'm unable to replicate locally * Turn down verbosity of CI tests, fix tests, potential speedup * Squash migration * Add encoding to open * Update to v3 upload-artifact Resolves a deprecation warning
This commit is contained in:
@@ -30,15 +30,15 @@ for app in [apps.get_app_config(label) for label in ("RIGS", "assets", "training
|
||||
modelname = model.__name__.lower()
|
||||
if appname == 'rigboard':
|
||||
urlpatterns += [
|
||||
path('{}/<str:pk>/history/'.format(modelname),
|
||||
permission_required_with_403('{}.change_{}'.format(app.label, modelname))(
|
||||
path(f'{modelname}/<str:pk>/history/',
|
||||
permission_required_with_403(f'{app.label}.change_{modelname}')(
|
||||
views.VersionHistory.as_view()),
|
||||
name='{}_history'.format(modelname), kwargs={'model': model, 'app': appname, }),
|
||||
name=f'{modelname}_history', kwargs={'model': model, 'app': appname, }),
|
||||
]
|
||||
else:
|
||||
urlpatterns += [
|
||||
path('{}/{}/<str:pk>/history/'.format(appname, modelname),
|
||||
permission_required_with_403('{}.change_{}'.format(app.label, modelname))(
|
||||
path(f'{appname}/{modelname}/<str:pk>/history/',
|
||||
permission_required_with_403(f'{app.label}.change_{modelname}')(
|
||||
views.VersionHistory.as_view()),
|
||||
name='{}_history'.format(modelname), kwargs={'model': model, 'app': appname, }),
|
||||
name=f'{modelname}_history', kwargs={'model': model, 'app': appname, }),
|
||||
]
|
||||
|
||||
@@ -160,7 +160,10 @@ class ModelComparison:
|
||||
# Build some dicts of what we have
|
||||
item_dict = {} # build a list of items, key is the item_pk
|
||||
for version in old_item_versions: # put all the old versions in a list
|
||||
compare = ModelComparison(old=version._object_version.object, **comparisonParams)
|
||||
old = version._object_version.object
|
||||
if old is None:
|
||||
pass
|
||||
compare = ModelComparison(old=old, **comparisonParams)
|
||||
item_dict[version.object_id] = compare
|
||||
|
||||
for version in new_item_versions: # go through the new versions
|
||||
|
||||
@@ -27,10 +27,10 @@ class VersionHistory(generic.ListView):
|
||||
return get_object_or_404(self.kwargs['model'], pk=self.kwargs['pk'])
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(VersionHistory, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['object'] = self.get_object()
|
||||
if self.kwargs['app'] != 'rigboard':
|
||||
context['override'] = 'base_{}.html'.format(self.kwargs['app'])
|
||||
context['override'] = f'base_{self.kwargs["app"]}.html'
|
||||
|
||||
return context
|
||||
|
||||
@@ -59,10 +59,10 @@ class ActivityTable(generic.ListView):
|
||||
return RIGSVersion.objects.get_for_multiple_models(filter_models(self.kwargs.get('models'), self.request.user)).order_by("-revision__date_created")
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ActivityTable, self).get_context_data(**kwargs)
|
||||
context['page_title'] = "{} Activity Stream".format(title(self.kwargs['app']))
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = f"{title(self.kwargs['app'])} Activity Stream"
|
||||
if self.kwargs['app'] != 'rigboard':
|
||||
context['override'] = 'base_{}.html'.format(self.kwargs['app'])
|
||||
context['override'] = f'base_{self.kwargs["app"]}.html'
|
||||
|
||||
return context
|
||||
|
||||
@@ -77,7 +77,7 @@ class ActivityFeed(generic.ListView): # Appears on homepage
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# Call the base implementation first to get a context
|
||||
context = super(ActivityFeed, self).get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['page_title'] = "Activity Feed"
|
||||
maxTimeDelta = datetime.timedelta(hours=1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user