コード例 #1
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)
コード例 #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)
コード例 #3
0
ファイル: fields.py プロジェクト: edoburu/django-any-urlfield
 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)
コード例 #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)