Skip to content

Commit

Permalink
Fixes #15891: Ensure deterministic ordering for scripts & reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed May 1, 2024
1 parent d256c04 commit b01da95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions netbox/extras/migrations/0091_create_managedfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Migration(migrations.Migration):
],
options={
'proxy': True,
'ordering': ('file_root', 'file_path'),
'indexes': [],
'constraints': [],
},
Expand All @@ -61,6 +62,7 @@ class Migration(migrations.Migration):
],
options={
'proxy': True,
'ordering': ('file_root', 'file_path'),
'indexes': [],
'constraints': [],
},
Expand Down
1 change: 1 addition & 0 deletions netbox/extras/models/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ReportModule(PythonModuleMixin, JobsMixin, ManagedFile):

class Meta:
proxy = True
ordering = ('file_root', 'file_path')
verbose_name = _('report module')
verbose_name_plural = _('report modules')

Expand Down
1 change: 1 addition & 0 deletions netbox/extras/models/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ScriptModule(PythonModuleMixin, JobsMixin, ManagedFile):

class Meta:
proxy = True
ordering = ('file_root', 'file_path')
verbose_name = _('script module')
verbose_name_plural = _('script modules')

Expand Down
4 changes: 2 additions & 2 deletions netbox/extras/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def get_required_permission(self):
return 'extras.view_report'

def get(self, request):
report_modules = ReportModule.objects.restrict(request.user)
report_modules = ReportModule.objects.restrict(request.user).prefetch_related('data_source', 'data_file')

return render(request, 'extras/report_list.html', {
'model': ReportModule,
Expand Down Expand Up @@ -1217,7 +1217,7 @@ def get_required_permission(self):
return 'extras.view_script'

def get(self, request):
script_modules = ScriptModule.objects.restrict(request.user)
script_modules = ScriptModule.objects.restrict(request.user).prefetch_related('data_source', 'data_file')

return render(request, 'extras/script_list.html', {
'model': ScriptModule,
Expand Down

0 comments on commit b01da95

Please sign in to comment.