[ORM] How to query object by a custom field value pattern (regex)? #6478
-
How can I query an object (Device, DeviceRole, etc.) by it's custom field value pattern from my plugin/script/report? from dcim.models import Device
device = Device.objects.filter(custom_field_data__contains={'backup_location': 'cbackup://12345'}) I need to request a model by custom field value pattern (for example, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
How about
Probably not the most efficient QuerySet ever but it should work! |
Beta Was this translation helpful? Give feedback.
How about
Probably not the most efficient QuerySet ever but it should work!