1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#15277: Clean up references to object types in templates

This commit is contained in:
Jeremy Stretch
2024-03-04 11:49:39 -05:00
parent 0419a69ae8
commit 0e89f46601
7 changed files with 10 additions and 15 deletions

View File

@@ -762,8 +762,8 @@ class ImageAttachmentEditView(generic.ObjectEditView):
def alter_object(self, instance, request, args, kwargs):
if not instance.pk:
# Assign the parent object based on URL kwargs
content_type = get_object_or_404(ContentType, pk=request.GET.get('content_type'))
instance.parent = get_object_or_404(content_type.model_class(), pk=request.GET.get('object_id'))
object_type = get_object_or_404(ContentType, pk=request.GET.get('object_type'))
instance.parent = get_object_or_404(object_type.model_class(), pk=request.GET.get('object_id'))
return instance
def get_return_url(self, request, obj=None):
@@ -771,7 +771,7 @@ class ImageAttachmentEditView(generic.ObjectEditView):
def get_extra_addanother_params(self, request):
return {
'content_type': request.GET.get('content_type'),
'object_type': request.GET.get('object_type'),
'object_id': request.GET.get('object_id'),
}