Source

django-helper / django_helper / migrations / 0005_auto__chg_field_model_date_hierarchy.py

# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):

        # Renaming column for 'Model.date_hierarchy' to match new field type.
        db.rename_column('django_helper_model', 'date_hierarchy', 'date_hierarchy_id')
        # Changing field 'Model.date_hierarchy'
        db.alter_column('django_helper_model', 'date_hierarchy_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['django_helper.Field']))
        # Adding index on 'Model', fields ['date_hierarchy']
        db.create_index('django_helper_model', ['date_hierarchy_id'])


    def backwards(self, orm):
        # Removing index on 'Model', fields ['date_hierarchy']
        db.delete_index('django_helper_model', ['date_hierarchy_id'])


        # Renaming column for 'Model.date_hierarchy' to match new field type.
        db.rename_column('django_helper_model', 'date_hierarchy_id', 'date_hierarchy')
        # Changing field 'Model.date_hierarchy'
        db.alter_column('django_helper_model', 'date_hierarchy', self.gf('django.db.models.fields.BooleanField')())

    models = {
        'django_helper.contextprocessor': {
            'Meta': {'object_name': 'ContextProcessor'},
            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'app_name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
            'required_middleware': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['django_helper.Middleware']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'django_helper.field': {
            'Meta': {'object_name': 'Field'},
            'auto_now': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'auto_now_add': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'blank': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'db_column': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'db_index': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'db_table': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'db_tablespace': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'decimal_places': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'default': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
            'editable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'field_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_helper.FieldType']"}),
            'help_text': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'limit_choices_to': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'max_digits': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'max_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'model': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_helper.Model']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
            'null': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'on_delete': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'othermodel': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'othermodel_set'", 'null': 'True', 'to': "orm['django_helper.Model']"}),
            'primary_key': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'related_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
            'through': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'through_set'", 'null': 'True', 'to': "orm['django_helper.Model']"}),
            'to_field': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'foreign_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'unique': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'unique_for_date': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'date_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'unique_for_month': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'month_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'unique_for_year': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'year_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'upload_to': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
            'verbose_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'})
        },
        'django_helper.fieldtype': {
            'Meta': {'object_name': 'FieldType'},
            'backend_storage': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'})
        },
        'django_helper.middleware': {
            'Meta': {'object_name': 'Middleware'},
            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'app_name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
            'process_exception': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'process_request': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'process_response': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'process_template_response': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'process_view': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
        },
        'django_helper.model': {
            'Meta': {'object_name': 'Model'},
            'absolute_url': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
            'date_hierarchy': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'hierarchy_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'exclude': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'exclude_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'fields': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'field_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'filter_horizontal': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'hfilter_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'filter_vertical': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'vfilter_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'inlines': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['django_helper.Model']", 'null': 'True', 'blank': 'True'}),
            'list_display': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'display_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'list_filter': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'filter_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
            'raw_id_fields': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'rawid_set'", 'blank': 'True', 'to': "orm['django_helper.Field']"}),
            'unicode': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'unicode_set'", 'null': 'True', 'to': "orm['django_helper.Field']"}),
            'unicode_str': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'})
        },
        'django_helper.templatetag': {
            'Meta': {'object_name': 'TemplateTag'},
            'added_on': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'app_name': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
            'description': ('django.db.models.fields.TextField', [], {}),
            'examples': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'parameters': ('django.db.models.fields.CharField', [], {'max_length': '60', 'blank': 'True'}),
            'required_context': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['django_helper.ContextProcessor']", 'symmetrical': 'False', 'blank': 'True'}),
            'tag_name': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
            'tag_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {}),
            'takes_context': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'template': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'})
        }
    }

    complete_apps = ['django_helper']