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
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)
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)
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)
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)
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)
def south_field_triple(self): "Returns a suitable description of this field for South." from south.modelsinspector import introspector # class path modified for QR thirdparty field_class = "qr.thirdparty.uuidfield.fields.UUIDField" args, kwargs = introspector(self) return (field_class, args, kwargs)
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)
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)
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], ), }, )
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)
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)
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 = "staff.fields.RemoveableFileField" args, kwargs = introspector(self) return (field_class, args, kwargs)
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)
def south_field_triple(self): """ Return a suitable description of this field for South. """ from south.modelsinspector import introspector field_class = 'django.db.models.fields.files.FileField' args, kwargs = introspector(self) return (field_class, args, kwargs)
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)
def south_field_triple(self): """ South compatibility. """ from south.modelsinspector import introspector field_class = "django.db.models.fields.SlugField" args, kwargs = introspector(self) return (field_class, args, kwargs)
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 = "django.db.models.fields.CharField" args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)
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 = '.'.join([self.__class__.__module__, self.__class__.__name__]) args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)
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)
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
def south_field_triple(self): "Returns a suitable description of this field for South." args, kwargs = introspector(self) field_class = self.__class__.__module__ + "." + self.__class__.__name__ kwargs.update({ 'populate_from': repr(self.populate_from) }) return (field_class, args, kwargs)
def south_field_triple(self): """South field descriptor. """ from south.modelsinspector import introspector field_class = "django.db.models.fields.files.ImageField" args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): from south.modelsinspector import introspector cls_name = '%s.%s' % ( self.__class__.__module__, self.__class__.__name__ ) args, kwargs = introspector(self) return (cls_name, args, kwargs)
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.IntegerField" args, kwargs = introspector(self) # That's our definition! return field_class, args, kwargs
def south_field_triple(self): "Returns a suitable description of this field for South." args, kwargs = introspector(self) kwargs.update({ 'populate_from': 'None' if callable(self.populate_from) else repr(self.populate_from), 'unique_with': repr(self.unique_with) }) return ('autoslug.fields.AutoSlugField', args, kwargs)
def south_field_triple(self): """ Return a suitable description of this field for South. Taken from smiley chris' easy_thumbnails """ from south.modelsinspector import introspector field_class = 'django.db.models.fields.TextField' args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): "Returns a suitable description of this field for South." from south.modelsinspector import introspector field_class = '%s.VersionSlugField' % self.__module__ args, kwargs = introspector(self) kwargs.update({ 'populate_from': repr(self._populate_from), }) return (field_class, args, kwargs)
def south_field_triple(self): """ Because this field will be defined as a decorator, give South hints on how to recreate it for database use. """ from south.modelsinspector import introspector field_class = DBField.__module__ + "." + DBField.__name__ args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): # pragma: no cover """ Return 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.files.ImageField" args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): # pragma: no cover """ Returns a suitable description of this field for South. This is excluded from coverage reports since it is pretty much a piece of South itself, and does not influence program behavior at all in case we don't use South. """ # We'll just introspect the _actual_ field. from south.modelsinspector import introspector #field_class = "django.db.models.Field" field_class = "common.fields.ListField" args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)
def south_field_triple(self): from south.modelsinspector import introspector, NOT_PROVIDED args, kwargs = introspector(self) # repr(Item) is not only invalid as an lookup value, it actually causes # South to generate invalid Python if self.default != NOT_PROVIDED: kwargs['default'] = None # Cannot set a real default if the "default" kwarg is a callable. if not callable(self.default): kwargs['default'] = self.default and self.default.value return ('django.db.models.fields.IntegerField', args, kwargs)
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 = '%s.AutoSlugField' % self.__module__ args, kwargs = introspector(self) kwargs.update({ 'populate_from': repr(self._populate_from), 'separator': repr(self.separator), 'overwrite': repr(self.overwrite), 'allow_duplicates': repr(self.allow_duplicates), }) # That's our definition! return (field_class, args, kwargs)
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 = '%s.RandomCharField' % (self.__module__) args, kwargs = introspector(self) kwargs.update({ 'alpha_only': repr(self.alpha_only), 'digits_only': repr(self.digits_only), 'include_punctuation': repr(self.include_punctuation), 'length': repr(self.length), 'lower': repr(self.lower), }) # That's our definition! return (field_class, args, kwargs)
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 try: # Check if the field provides its own 'field_class': field_class = self.translated_field.south_field_triple()[0] except AttributeError: field_class = '%s.%s' % (self.translated_field.__class__.__module__, self.translated_field.__class__.__name__) args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)
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 = '%s.%s' % (self.__module__, self.__class__.__name__) args, kwargs = introspector(self) kwargs.update({ 'length': repr(self.length), 'exclude_upper': repr(self.exclude_upper), 'exclude_lower': repr(self.exclude_lower), 'exclude_digits': repr(self.exclude_digits), 'exclude_vowels': repr(self.exclude_vowels), }) # That's our definition! return (field_class, args, kwargs)
def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect the _actual_ field. try: from south.modelsinspector import introspector field_class = self.__class__.__module__ + "." + self.__class__.__name__ args, kwargs = introspector(self) # That's our definition! kwargs.update({ 'start_query': repr(self.start_query), 'size_width': repr(self.size_width), 'size_height': repr(self.size_height), }) return ('django_ymap.fields.YmapCoord', args, kwargs) except ImportError: pass
def south_field_triple(self): try: from south.modelsinspector import introspector except ImportError: pass else: cls_name = '{}.{}'.format(self.__class__.__module__, self.__class__.__name__) args, kwargs = introspector(self) if hasattr(self, 'max_choices'): kwargs["max_choices"] = self.max_choices if hasattr(self, 'include_blank'): kwargs["include_blank"] = self.include_blank return (cls_name, args, kwargs)
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 = '%s.RandomCharField' % self.__module__ args, kwargs = introspector(self) kwargs.update({ 'lowercase': repr(self.lowercase), 'include_digits': repr(self.include_digits), 'include_aphla': repr(self.include_alpha), 'include_punctuation': repr(self.include_punctuation), 'length': repr(self.length), 'unique': repr(self.unique), }) del kwargs['max_length'] # That's our definition! return field_class, args, kwargs
def south_field_triple(self): try: from south.modelsinspector import introspector cls_name = '%s.%s' % (self.__class__.__module__, 'MultiDBSouthField') args, kwargs = introspector(self) #因为mysql不支持跨库的外键关系,不在数据库中构建外键关系 if 'to' in kwargs: del kwargs['to'] #数据库建立索引 if 'db_index' not in kwargs: kwargs['db_index'] = True return cls_name, args, kwargs except ImportError: pass
def south_field_triple(self): """Return a suitable description of this field for South.""" from south.modelsinspector import introspector args, kwargs = introspector(self) state_def = tuple( (str(st.name), str(st.name)) for st in self.workflow.states) initial_state_def = str(self.workflow.initial_state.name) workflow = ( "__import__('xworkflows', globals(), locals()).base.WorkflowMeta(" "'%(class_name)s', (), " "{'states': %(states)r, 'initial_state': %(initial_state)r})" % { 'class_name': str(self.workflow.__class__.__name__), 'states': state_def, 'initial_state': initial_state_def, }) kwargs['workflow'] = workflow return ('django_xworkflows.models.StateField', args, kwargs)
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)
def south_field_triple(self): from south.modelsinspector import introspector field_class = "django.db.models.fields.CharField" args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): from south.modelsinspector import introspector cls_name = '%s.%s' % (self.__class__.__module__, self.__class__.__name__) args, kwargs = introspector(self) return (cls_name, args, kwargs)
def south_field_triple(self): # pragma no cover from south.modelsinspector import introspector name = '%s.%s' % (self.__class__.__module__, self.__class__.__name__) args, kwargs = introspector(self) return name, args, kwargs
def south_field_triple(self): from south.modelsinspector import introspector field_class = self.__class__.__module__ + "." + self.__class__.__name__ args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): from south.modelsinspector import introspector path = f"{self.__class__.__module__}.{self.__class__.__name__}" args, kwargs = introspector(self) return (path, args, kwargs)
def south_field_triple(self): # Masquerade as normal ImageField, so the soft-dependency also exists in the migrations. from south.modelsinspector import introspector path = "{0}.{1}".format(models.ImageField.__module__, models.ImageField.__name__) args, kwargs = introspector(self) return (path, args, kwargs)
def test_status_field_no_check_for_status(self): sf = StatusFieldDefaultFilled._meta.get_field('status') args, kwargs = introspector(sf) self.assertEqual(kwargs['no_check_for_status'], 'True')
def south_field_triple(self): from south.modelsinspector import introspector args, kwargs = introspector(self) del kwargs['max_length'] return 'colorful.fields.RGBColorField', args, kwargs
def south_field_triple(self): # Return a suitable description of this field for South. from south.modelsinspector import introspector field_class = 'django.db.models.fields.files.ImageField' args, kwargs = introspector(self) return (field_class, args, kwargs)
def south_field_triple(self): "Returns a suitable description of this field for South." from south.modelsinspector import introspector field_class = "django.db.models.PositiveIntegerField" args, kwargs = introspector(self) return (field_class, [], {'db_column': "%r" % self.column})
def south_field_triple(self): "Returns a suitable description of this field for South." from south.modelsinspector import introspector field_class = "uuidfield.fields.UUIDField" args, kwargs = introspector(self) return (field_class, args, kwargs)
def test_introspector_adds_no_excerpt_field(self): mf = Article._meta.get_field('body') args, kwargs = introspector(mf) self.assertEqual(kwargs['no_excerpt_field'], 'True')
def south_field_triple(self): from south.modelsinspector import introspector name = 'stringfield.StringField' args, kwargs = introspector(self) kwargs.pop('max_length', None) return name, args, kwargs
def south_field_triple(self): from south.modelsinspector import introspector args, kwargs = introspector(self) return 'django.db.models.TextField', args, kwargs
def south_field_triple(self): "Returns a suitable description of this field for South." args, kwargs = introspector(self) kwargs.update({'populate_from': 'None', 'unique_with': '()'}) return ('autoslug.fields.AutoSlugField', args, kwargs)
def south_field_triple(self): args, kwargs = introspector(self) return 'django.db.models.fields.DateTimeField', args, kwargs