openslides_backend/models/base.py
def try_get_field(self, field_name: str) -> Optional[fields.Field]:
        """
        Returns the field for the given field name. You may give the
        pythonic field name or even a populated template field.

        E. g. for User the `group__ids` field alias `group_$_ids` field is also found
        if you look for `group_$42_ids`.

        Returns None if field is not found.
        """
        prefix = field_name.split("$")[0]
        if prefix not in self.field_prefix_map:
            return None

        field = self.field_prefix_map[prefix]
        if isinstance(field, fields.BaseTemplateField):
            # We use the regex here since we want to also match template fields.
            if "$" in field_name and not re.match(field.get_regex(), field_name):
                return None
        return field

        Returns the field for the given field name. You may give the
        pythonic field name or even a populated template field.

        E. g. for User the `group__ids` field alias `group_$_ids` field is also found
        if you look for `group_$42_ids`.

        Returns None if field is not found.
        
Returns the field for the given field name. You may give the
pythonic field name or even a populated template field.

E. g.

Returns None if field is not found.
Returns the field for the given field name . You may give the pythonic field name or even a populated template field . E . g . Returns None if field is not found .
def try_get_field(self, field_name: str) -> Optional[fields.Field]:
        prefix = field_name.split("$")[0]
        if prefix not in self.field_prefix_map:
            return None
        field = self.field_prefix_map[prefix]
        if isinstance(field, fields.BaseTemplateField):
            if "$" in field_name and not re.match(field.get_regex(), field_name):
                return None
        return field
def try_get_field ( self , field_name : str ) -> Optional [ fields . Field ] : prefix = field_name . split ( "$" ) [ 0 ] if prefix not in self . field_prefix_map : return None field = self . field_prefix_map [ prefix ] if isinstance ( field , fields . BaseTemplateField ) : if "$" in field_name and not re . match ( field . get_regex ( ) , field_name ) : return None return field
Returns the field for the given field name.
Returns the field for the given field name .
"""
        Returns the field for the given field name. You may give the
        pythonic field name or even a populated template field.

        E. g. for User the `group__ids` field alias `group_$_ids` field is also found
        if you look for `group_$42_ids`.

        Returns None if field is not found.
        """ # We use the regex here since we want to also match template fields.
self
field_name
str