Kani999 / netbox-attachments

Plugin to manage attachments for any model
Apache License 2.0
55 stars 4 forks source link

Nested serializers are being deprecaded from netbox 4 #65

Closed matejv closed 1 month ago

matejv commented 2 months ago

Netbox plugin migration guide instructs plugin developers to remove Nested API serializers and add support for "brief" mode to regular serializers .

In netbox-inventory plugin I have done as the migration guide instructs and now users cannot use netbox-inventory with netbox-attachments. See this issue for detailed description.

The problem originates here by calling get_serializer_for_model with prefix argument.

You should probably change this to get a regular serializer and pass brief=True when calling it.

If you wanted to keep backward compatibility you could first try to get nested serializer as it is now and on netbox.api.exceptions.SerializerNotFound error get the regular serializer with brief=True.

I can submit a pull request if you'd like.

Kani999 commented 2 months ago

I'll take a look at it, I also need to do some other changes.

Kani999 commented 2 months ago

@matejv could you try to install changes from https://github.com/Kani999/netbox-attachments/pull/66/files if everything works fine?

matejv commented 2 months ago

Seems to work fine, thank you. I tested attachments on netbox_inventory.Asset (plugin) model and dcim.DeviceType.