Open jvanderaa opened 10 months ago
This might be doable, but it would require creating a custom subclass of ManyToManyField
that understands setting by name instead of setting by value, and updating models to use that subclass.
(edit) Also you don't need the ID per se - location_type.content_types.add(ContentType.objects.get_for_model(Device))
should work just fine.
As ...
Austin - Network Automation Engineer
I want ...
to have Nautobot determine the ID for me when I use the set or add methods, not require me to have to figure out the ID first.
So that ...
Development makes sense. I understand the Django side of things and working with IDs. But from a network automation app development perspective, now every developer that wants to add content types has to figure out the code to first get the ID from the name of the content type. That is not very DRY when it should just be in Nautobot.
This code should in my opinion be valid:
I know this is done when...
When I can execute
location_type.content_types.set(["dcim.device"])
Optional - Feature groups this request pertains to.
Database Changes
None
External Dependencies
No response