Skip to content

Commit

Permalink
Change lookups to new related names in msgmaint
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Jan 10, 2023
1 parent 7896dbc commit 0aa942e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/nav/models/msgmaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_components(self):
"""
Returns the list of model objects involved in this task
"""
return [c.component for c in self.maintenancecomponent_set.all()]
return [c.component for c in self.maintenance_components.all()]

def get_event_subjects(self):
"""
Expand Down
8 changes: 4 additions & 4 deletions python/nav/web/maintenance/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def active(request):
state__in=(MaintenanceTask.STATE_SCHEDULED, MaintenanceTask.STATE_ACTIVE),
)
.order_by('-start_time', '-end_time')
.annotate(component_count=Count('maintenancecomponent'))
.annotate(component_count=Count('maintenance_components'))
)
for task in tasks:
# Tasks that have only one component should show a link
Expand Down Expand Up @@ -147,7 +147,7 @@ def planned(request):
state__in=(MaintenanceTask.STATE_SCHEDULED, MaintenanceTask.STATE_ACTIVE),
)
.order_by('-start_time', '-end_time')
.annotate(component_count=Count('maintenancecomponent'))
.annotate(component_count=Count('maintenance_components'))
)
return render(
request,
Expand All @@ -172,7 +172,7 @@ def historic(request):
)
)
.order_by('-start_time', '-end_time')
.annotate(component_count=Count('maintenancecomponent'))
.annotate(component_count=Count('maintenance_components'))
)
return render(
request,
Expand Down Expand Up @@ -270,7 +270,7 @@ def edit(request, task_id=None, start_time=None, **_):
'location': [],
'netboxgroup': [],
}
for key, value in task.maintenancecomponent_set.values_list('key', 'value'):
for key, value in task.maintenance_components.values_list('key', 'value'):
if key in PRIMARY_KEY_INTEGER:
value = int(value)
component_keys[key].append(value)
Expand Down

0 comments on commit 0aa942e

Please sign in to comment.