def to_python(self, value):
        if isinstance(value, AnyUrlValue):
            return value

        # Convert the string value
        if value is None:
            return None

        return AnyUrlValue.from_db_value(value, self._static_registry)
Exemple #2
0
    def to_python(self, value):
        if isinstance(value, AnyUrlValue):
            return value

        # Convert the string value
        if value is None:
            return None

        return AnyUrlValue.from_db_value(value, self._static_registry)
 def from_db_value(self, value, expression, connection, context):
     # This method is used to cast DB values to python values.
     # The call to to_python() is not used anymore.
     if value is None:
         return None
     return AnyUrlValue.from_db_value(value, self._static_registry)
Exemple #4
0
 def from_db_value(self, value, expression, connection, context=None):
     # This method is used to cast DB values to python values.
     # The call to to_python() is not used anymore.
     if value is None:
         return None
     return AnyUrlValue.from_db_value(value, self._static_registry)