Source

django-helper / django_helper / migrations / 0004_auto__add_field_model_unicode__add_field_model_unicode_str__add_field_.py

Full commit
# -*- 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):
        # Adding field 'Model.unicode'
        db.add_column('django_helper_model', 'unicode',
                      self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='unicode_set', null=True, to=orm['django_helper.Field']),
                      keep_default=False)

        # Adding field 'Model.unicode_str'
        db.add_column('django_helper_model', 'unicode_str',
                      self.gf('django.db.models.fields.CharField')(default='', max_length=80, blank=True),
                      keep_default=False)

        # Adding field 'Model.absolute_url'
        db.add_column('django_helper_model', 'absolute_url',
                      self.gf('django.db.models.fields.CharField')(default='', max_length=80, blank=True),
                      keep_default=False)

        # Adding field 'Model.date_hierarchy'
        db.add_column('django_helper_model', 'date_hierarchy',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'Model.inlines'
        db.add_column('django_helper_model', 'inlines',
                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['django_helper.Model'], null=True, blank=True),
                      keep_default=False)

        # Adding M2M table for field exclude on 'Model'
        db.create_table('django_helper_model_exclude', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_exclude', ['model_id', 'field_id'])

        # Adding M2M table for field fields on 'Model'
        db.create_table('django_helper_model_fields', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_fields', ['model_id', 'field_id'])

        # Adding M2M table for field filter_horizontal on 'Model'
        db.create_table('django_helper_model_filter_horizontal', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_filter_horizontal', ['model_id', 'field_id'])

        # Adding M2M table for field filter_vertical on 'Model'
        db.create_table('django_helper_model_filter_vertical', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_filter_vertical', ['model_id', 'field_id'])

        # Adding M2M table for field list_display on 'Model'
        db.create_table('django_helper_model_list_display', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_list_display', ['model_id', 'field_id'])

        # Adding M2M table for field list_filter on 'Model'
        db.create_table('django_helper_model_list_filter', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_list_filter', ['model_id', 'field_id'])

        # Adding M2M table for field raw_id_fields on 'Model'
        db.create_table('django_helper_model_raw_id_fields', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('model', models.ForeignKey(orm['django_helper.model'], null=False)),
            ('field', models.ForeignKey(orm['django_helper.field'], null=False))
        ))
        db.create_unique('django_helper_model_raw_id_fields', ['model_id', 'field_id'])


    def backwards(self, orm):
        # Deleting field 'Model.unicode'
        db.delete_column('django_helper_model', 'unicode_id')

        # Deleting field 'Model.unicode_str'
        db.delete_column('django_helper_model', 'unicode_str')

        # Deleting field 'Model.absolute_url'
        db.delete_column('django_helper_model', 'absolute_url')

        # Deleting field 'Model.date_hierarchy'
        db.delete_column('django_helper_model', 'date_hierarchy')

        # Deleting field 'Model.inlines'
        db.delete_column('django_helper_model', 'inlines_id')

        # Removing M2M table for field exclude on 'Model'
        db.delete_table('django_helper_model_exclude')

        # Removing M2M table for field fields on 'Model'
        db.delete_table('django_helper_model_fields')

        # Removing M2M table for field filter_horizontal on 'Model'
        db.delete_table('django_helper_model_filter_horizontal')

        # Removing M2M table for field filter_vertical on 'Model'
        db.delete_table('django_helper_model_filter_vertical')

        # Removing M2M table for field list_display on 'Model'
        db.delete_table('django_helper_model_list_display')

        # Removing M2M table for field list_filter on 'Model'
        db.delete_table('django_helper_model_list_filter')

        # Removing M2M table for field raw_id_fields on 'Model'
        db.delete_table('django_helper_model_raw_id_fields')


    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.BooleanField', [], {'default': 'False'}),
            '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']