I have a field in which REGEX templates are stored, and I'm trying to filter out the model in which it is located, comparing it with the hostname passed in the variable. (Example: here I just encoded REGEX.
Sys_team.objects.filter(hostname= r'^.*\.amgr\..*')
I met this error:
FieldError: Cannot resolve keyword 'hostname' into field. Choices are: alert, id, pattern, pub_date, sys_team
The host name has the format: xxx.amgr.xxx
Does this mean that only fields can go on the left side of the filter? And if so, is there any other way to compare these two with the REGEX pattern on the left side. To repeat, the host name is not a field.
source
share