Skip to content

Fixes #15891: Ensure deterministic ordering for scripts & reports #15907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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