當前位置: 首頁>>代碼示例>>Python>>正文


Python datastructures.DictWrapper方法代碼示例

本文整理匯總了Python中django.utils.datastructures.DictWrapper方法的典型用法代碼示例。如果您正苦於以下問題:Python datastructures.DictWrapper方法的具體用法?Python datastructures.DictWrapper怎麽用?Python datastructures.DictWrapper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在django.utils.datastructures的用法示例。


在下文中一共展示了datastructures.DictWrapper方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: db_type

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_type(self, connection):
        """
        Returns the database column data type for this field, for the provided
        connection.
        """
        # The default implementation of this method looks at the
        # backend-specific data_types dictionary, looking up the field by its
        # "internal type".
        #
        # A Field class can implement the get_internal_type() method to specify
        # which *preexisting* Django Field class it's most similar to -- i.e.,
        # a custom field might be represented by a TEXT column type, which is
        # the same as the TextField Django field type, which means the custom
        # field's get_internal_type() returns 'TextField'.
        #
        # But the limitation of the get_internal_type() / data_types approach
        # is that it cannot handle database column types that aren't already
        # mapped to one of the built-in Django field types. In this case, you
        # can implement db_type() instead of get_internal_type() to specify
        # exactly which wacky database column type you want to use.
        data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
        try:
            return connection.data_types[self.get_internal_type()] % data
        except KeyError:
            return None 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:27,代碼來源:__init__.py

示例2: db_parameters

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_parameters(self, connection):
        """
        Extension of db_type(), providing a range of different return
        values (type, checks).
        This will look at db_type(), allowing custom model fields to override it.
        """
        data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
        type_string = self.db_type(connection)
        try:
            check_string = connection.data_type_check_constraints[self.get_internal_type()] % data
        except KeyError:
            check_string = None
        return {
            "type": type_string,
            "check": check_string,
        } 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:18,代碼來源:__init__.py

示例3: db_type

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_type(self, connection):
        """
        Return the database column data type for this field, for the provided
        connection.
        """
        # The default implementation of this method looks at the
        # backend-specific data_types dictionary, looking up the field by its
        # "internal type".
        #
        # A Field class can implement the get_internal_type() method to specify
        # which *preexisting* Django Field class it's most similar to -- i.e.,
        # a custom field might be represented by a TEXT column type, which is
        # the same as the TextField Django field type, which means the custom
        # field's get_internal_type() returns 'TextField'.
        #
        # But the limitation of the get_internal_type() / data_types approach
        # is that it cannot handle database column types that aren't already
        # mapped to one of the built-in Django field types. In this case, you
        # can implement db_type() instead of get_internal_type() to specify
        # exactly which wacky database column type you want to use.
        data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
        try:
            return connection.data_types[self.get_internal_type()] % data
        except KeyError:
            return None 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:27,代碼來源:__init__.py

示例4: db_type_parameters

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_type_parameters(self, connection):
        return DictWrapper(self.__dict__, connection.ops.quote_name, 'qn_')

    # Subclasses should take this value and add parametised values with str overload DBType 
開發者ID:ashleywaite,項目名稱:django-more,代碼行數:6,代碼來源:fields.py

示例5: db_type_parameters

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_type_parameters(self, connection):
        return DictWrapper(self.__dict__, connection.ops.quote_name, 'qn_') 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:4,代碼來源:__init__.py

示例6: db_check

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_check(self, connection):
        """
        Return the database column check constraint for this field, for the
        provided connection. Works the same way as db_type() for the case that
        get_internal_type() does not map to a preexisting model field.
        """
        data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
        try:
            return connection.data_type_check_constraints[self.get_internal_type()] % data
        except KeyError:
            return None 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:13,代碼來源:__init__.py

示例7: db_type

# 需要導入模塊: from django.utils import datastructures [as 別名]
# 或者: from django.utils.datastructures import DictWrapper [as 別名]
def db_type(self, connection):
        """
        Returns the database column data type for this field, for the provided
        connection.
        """
        # The default implementation of this method looks at the
        # backend-specific DATA_TYPES dictionary, looking up the field by its
        # "internal type".
        #
        # A Field class can implement the get_internal_type() method to specify
        # which *preexisting* Django Field class it's most similar to -- i.e.,
        # a custom field might be represented by a TEXT column type, which is
        # the same as the TextField Django field type, which means the custom
        # field's get_internal_type() returns 'TextField'.
        #
        # But the limitation of the get_internal_type() / data_types approach
        # is that it cannot handle database column types that aren't already
        # mapped to one of the built-in Django field types. In this case, you
        # can implement db_type() instead of get_internal_type() to specify
        # exactly which wacky database column type you want to use.
        data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_")
        try:
            return (connection.creation.data_types[self.get_internal_type()]
                    % data)
        except KeyError:
            return None 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:28,代碼來源:__init__.py


注:本文中的django.utils.datastructures.DictWrapper方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。