本文整理汇总了Python中south.modelsinspector.introspector函数的典型用法代码示例。如果您正苦于以下问题:Python introspector函数的具体用法?Python introspector怎么用?Python introspector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了introspector函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: south_field_triple
def south_field_triple(self):
# Undo the softdep feature
# Show as Plugin..Field in the migrations.
from south.modelsinspector import introspector
path = _get_path(self.__class__)
args, kwargs = introspector(self)
return (path, args, kwargs)
示例2: south_field_triple
def south_field_triple(self):
"Returns a suitable description of this field for South."
from south.modelsinspector import introspector
field_class = "djangospot.utils.fields.SeparatedValuesField"
args, kwargs = introspector(self)
kwargs['token'] = repr(self.token)
return (field_class, args, kwargs)
示例3: south_field_triple
def south_field_triple(self):
''''Returns a suitable description of this field for South.'''
from south.modelsinspector import introspector
args, kwargs = introspector(models.CharField)
kwargs = dict(list(self.DEFAULT_KWARGS.items()) + list(kwargs.items()))
return ('django.db.models.fields.CharField', args, kwargs)
示例4: south_field_triple
def south_field_triple(self):
"Returns a suitable description of this field for South."
from south.modelsinspector import introspector
field_class = OneToOneField.__module__ + "." + OneToOneField.__name__
args, kwargs = introspector(self)
return (field_class, args, kwargs)
示例5: south_field_triple
def south_field_triple(self):
"Returns a suitable description of this field for South."
from south.modelsinspector import introspector
field_class = self.__class__.__module__ + "." + self.__class__.__name__
args, kwargs = introspector(self)
# That's our definition!
return (field_class, args, kwargs)
示例6: south_field_triple
def south_field_triple(self):
"""Return a description of this field parsable by South."""
# It's safe to import South at this point; this method
# will never actually be called unless South is installed.
from south.modelsinspector import introspector
# Get the args and kwargs with which this field was generated.
# The "double" variable name is a riff of of South "triples", since
# the `introspector` function only returns the final two elements
# of a South triple. This is fine since those two pieces are all
# we actually need.
double = introspector(self.of)
# Return the appropriate South triple.
return (
'%s.%s' % (self.__class__.__module__, self.__class__.__name__),
[],
{
# The `of` argument is *itself* another triple, of
# the internal field.
# The ArrayField constructor understands how to resurrect
# its internal field from this serialized state.
'of': (
'{module}.{class_name}'.format(
module=self.of.__class__.__module__,
class_name=self.of.__class__.__name__,
),
double[0],
double[1],
),
},
)
示例7: south_field_triple
def south_field_triple(self):
"Returns a suitable description of this field for South."
# We'll just introspect ourselves, since we inherit.
from south.modelsinspector import introspector
field_class = "django.db.models.fields.DateTimeField"
args, kwargs = introspector(self)
return (field_class, args, kwargs)
示例8: south_field_triple
def south_field_triple(self):
"""
Describe the field to south for use in migrations.
"""
from south.modelsinspector import introspector
args, kwargs = introspector(self)
return ("django.db.models.fields.TextField", args, kwargs)
示例9: south_field_triple
def south_field_triple(self):
"""Required for south to work.
"""
from south.modelsinspector import introspector
name = '%s.%s' % (self.__class__.__module__, self.__class__.__name__)
args, kwargs = introspector(self)
return name, args, kwargs
示例10: south_field_triple
def south_field_triple(self):
"""Returns a suitable description of this field for South."""
# We'll just introspect ourselves, since we inherit.
from south.modelsinspector import introspector
field_class = 'django.db.models.fields.related.ForeignKey'
args, kwargs = introspector(self)
return (field_class, args, kwargs)
示例11: south_field_triple
def south_field_triple(self):
"Returns a suitable description of this field for South."
from south.modelsinspector import introspector
field_class = "django.db.models.fields.BigIntegerField"
args, kwargs = introspector(self)
return (field_class, args, kwargs)
示例12: south_field_triple
def south_field_triple(self):
"""Return a suitable description for south."""
from south.modelsinspector import introspector
args, kwargs = introspector(self)
del kwargs['max_length']
kwargs['choices'] = [(key, key) for key in self.set_definition.choices]
return ('extypes.django.SetField', args, kwargs)
示例13: south_field_triple
def south_field_triple(self):
'Returns a suitable description of this field for South.'
# We'll just introspect ourselves, since we inherit.
from south.modelsinspector import introspector
fc = self.__class__
field_class = '%s.%s' % (fc.__module__, fc.__name__)
args, kwargs = introspector(self)
return (field_class, args, kwargs)
示例14: south_field_triple
def south_field_triple(self):
try:
from south.modelsinspector import introspector
cls_name = '{0}.{1}'.format(self.__class__.__module__, self.__class__.__name__)
args, kwargs = introspector(self)
return cls_name, args, kwargs
except ImportError:
pass
示例15: south_field_triple
def south_field_triple(self):
"""Returns a suitable description of this field for South."""
# We'll just introspect the _actual_ field.
from south.modelsinspector import introspector
field_class = self._c_native.__class__.__module__ + "." + self._c_native.__class__.__name__
args, kwargs = introspector(self._c_native)
# That's our definition!
return (field_class, args, kwargs)