mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 17:26:10 -06:00
11432 make internal var
This commit is contained in:
parent
a72349448d
commit
283878af7d
@ -38,22 +38,17 @@ class BaseReadonlyDeviceMixin:
|
|||||||
|
|
||||||
# get_extra_kwargs doesn't work if field explicitly declared on serializer...
|
# get_extra_kwargs doesn't work if field explicitly declared on serializer...
|
||||||
if (self.instance):
|
if (self.instance):
|
||||||
fields[self.get_field_name()].read_only = True
|
fields[self._field_name].read_only = True
|
||||||
|
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
|
|
||||||
class ReadonlyDeviceMixin(BaseReadonlyDeviceMixin):
|
class ReadonlyDeviceMixin(BaseReadonlyDeviceMixin):
|
||||||
|
_field_name = "device"
|
||||||
# can't be a field as mucks up serializer
|
|
||||||
def get_field_name(self):
|
|
||||||
return "device"
|
|
||||||
|
|
||||||
|
|
||||||
class ReadonlyDeviceTypeMixin(BaseReadonlyDeviceMixin):
|
class ReadonlyDeviceTypeMixin(BaseReadonlyDeviceMixin):
|
||||||
|
_field_name = "device_type"
|
||||||
def get_field_name(self):
|
|
||||||
return "device_type"
|
|
||||||
|
|
||||||
|
|
||||||
class CabledObjectSerializer(serializers.ModelSerializer):
|
class CabledObjectSerializer(serializers.ModelSerializer):
|
||||||
|
Loading…
Reference in New Issue
Block a user