Python south.db.db.shorten_name() Examples

The following are 23 code examples of south.db.db.shorten_name(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module south.db.db , or try the search function .
Example #1
Source File: 0001_initial.py    From crowdata with MIT License 6 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'DocumentSet'
        db.delete_table(u'crowdataapp_documentset')

        # Deleting model 'DocumentSetForm'
        db.delete_table(u'crowdataapp_documentsetform')

        # Removing M2M table for field sites on 'DocumentSetForm'
        db.delete_table(db.shorten_name(u'crowdataapp_documentsetform_sites'))

        # Deleting model 'DocumentSetFormField'
        db.delete_table(u'crowdataapp_documentsetformfield')

        # Deleting model 'DocumentSetFormEntry'
        db.delete_table(u'crowdataapp_documentsetformentry')

        # Deleting model 'Document'
        db.delete_table(u'crowdataapp_document')

        # Deleting model 'DocumentUserFormEntry'
        db.delete_table(u'crowdataapp_documentuserformentry') 
Example #2
Source File: 0006_auto__add_flowbit.py    From scirius with GNU General Public License v3.0 6 votes vote down vote up
def forwards(self, orm):
        # Adding model 'Flowbit'
        db.create_table(u'rules_flowbit', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('set', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('isset', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('enable', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('source', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rules.Source'])),
        ))
        db.send_create_signal(u'rules', ['Flowbit'])

        # Adding M2M table for field flowbits on 'Rule'
        m2m_table_name = db.shorten_name(u'rules_rule_flowbits')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('rule', models.ForeignKey(orm[u'rules.rule'], null=False)),
            ('flowbit', models.ForeignKey(orm[u'rules.flowbit'], null=False))
        ))
        db.create_unique(m2m_table_name, ['rule_id', 'flowbit_id']) 
Example #3
Source File: 0001_initial.py    From django-happenings with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'Event'
        db.delete_table(u'happenings_event')

        # Removing M2M table for field location on 'Event'
        db.delete_table(db.shorten_name(u'happenings_event_location'))

        # Removing M2M table for field categories on 'Event'
        db.delete_table(db.shorten_name(u'happenings_event_categories'))

        # Removing M2M table for field tags on 'Event'
        db.delete_table(db.shorten_name(u'happenings_event_tags'))

        # Deleting model 'Location'
        db.delete_table(u'happenings_location')

        # Deleting model 'Category'
        db.delete_table(u'happenings_category')

        # Deleting model 'Tag'
        db.delete_table(u'happenings_tag') 
Example #4
Source File: 0003_auto__del_reference__add_sourceupdate__chg_field_source_uri__del_field.py    From scirius with GNU General Public License v3.0 5 votes vote down vote up
def forwards(self, orm):
        # Deleting model 'Reference'
        db.delete_table(u'rules_reference')

        # Adding model 'SourceUpdate'
        db.create_table(u'rules_sourceupdate', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('source', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['rules.Source'])),
            ('created_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2014, 7, 31, 0, 0), blank=True)),
            ('data', self.gf('django.db.models.fields.TextField')()),
            ('version', self.gf('django.db.models.fields.CharField')(max_length=42)),
        ))
        db.send_create_signal(u'rules', ['SourceUpdate'])


        # Changing field 'Source.uri'
        db.alter_column(u'rules_source', 'uri', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
        # Deleting field 'Rule.id'
        db.delete_column(u'rules_rule', u'id')

        # Removing M2M table for field references on 'Rule'
        db.delete_table(db.shorten_name(u'rules_rule_references'))


        # Changing field 'Rule.sid'
        db.alter_column(u'rules_rule', 'sid', self.gf('django.db.models.fields.IntegerField')(primary_key=True)) 
Example #5
Source File: 0004_auto__add_eventtheme__add_eventaudience.py    From coding-events with MIT License 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'EventTheme'
        db.delete_table(u'api_eventtheme')

        # Deleting model 'EventAudience'
        db.delete_table(u'api_eventaudience')

        # Removing M2M table for field audience on 'Event'
        db.delete_table(db.shorten_name(u'api_event_audience'))

        # Removing M2M table for field theme on 'Event'
        db.delete_table(db.shorten_name(u'api_event_theme')) 
Example #6
Source File: 0004_auto__add_eventtheme__add_eventaudience.py    From coding-events with MIT License 5 votes vote down vote up
def forwards(self, orm):
        # Adding model 'EventTheme'
        db.create_table(
            u'api_eventtheme', ((u'id', self.gf('django.db.models.fields.AutoField')(
                primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(
                    max_length=255)), ))
        db.send_create_signal('api', ['EventTheme'])

        # Adding model 'EventAudience'
        db.create_table(
            u'api_eventaudience', ((u'id', self.gf('django.db.models.fields.AutoField')(
                primary_key=True)), ('name', self.gf('django.db.models.fields.CharField')(
                    max_length=255)), ))
        db.send_create_signal('api', ['EventAudience'])

        # Adding M2M table for field audience on 'Event'
        m2m_table_name = db.shorten_name(u'api_event_audience')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('event', models.ForeignKey(orm['api.event'], null=False)),
            ('eventaudience', models.ForeignKey(orm['api.eventaudience'], null=False))
        ))
        db.create_unique(m2m_table_name, ['event_id', 'eventaudience_id'])

        # Adding M2M table for field theme on 'Event'
        m2m_table_name = db.shorten_name(u'api_event_theme')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('event', models.ForeignKey(orm['api.event'], null=False)),
            ('eventtheme', models.ForeignKey(orm['api.eventtheme'], null=False))
        ))
        db.create_unique(m2m_table_name, ['event_id', 'eventtheme_id']) 
Example #7
Source File: 0008_auto__del_field_rawmeeting_committee.py    From legco-watch with MIT License 5 votes vote down vote up
def backwards(self, orm):
        # Adding field 'RawMeeting.committee'
        db.add_column(u'raw_rawmeeting', 'committee',
                      self.gf('django.db.models.fields.related.ForeignKey')(related_name='meetings', null=True, to=orm['raw.RawCommittee'], blank=True),
                      keep_default=False)

        # Removing M2M table for field committees on 'RawMeeting'
        db.delete_table(db.shorten_name(u'raw_rawmeeting_committees')) 
Example #8
Source File: 0008_auto__del_field_rawmeeting_committee.py    From legco-watch with MIT License 5 votes vote down vote up
def forwards(self, orm):
        # Deleting field 'RawMeeting.committee'
        db.delete_column(u'raw_rawmeeting', 'committee_id')

        # Adding M2M table for field committees on 'RawMeeting'
        m2m_table_name = db.shorten_name(u'raw_rawmeeting_committees')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('rawmeeting', models.ForeignKey(orm[u'raw.rawmeeting'], null=False)),
            ('rawcommittee', models.ForeignKey(orm[u'raw.rawcommittee'], null=False))
        ))
        db.create_unique(m2m_table_name, ['rawmeeting_id', 'rawcommittee_id']) 
Example #9
Source File: 0001_initial.py    From pyconkr-2014 with MIT License 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'Room'
        db.delete_table(u'pyconkr_room')

        # Deleting model 'ProgramDate'
        db.delete_table(u'pyconkr_programdate')

        # Deleting model 'ProgramTime'
        db.delete_table(u'pyconkr_programtime')

        # Deleting model 'SponsorLevel'
        db.delete_table(u'pyconkr_sponsorlevel')

        # Deleting model 'Sponsor'
        db.delete_table(u'pyconkr_sponsor')

        # Deleting model 'Speaker'
        db.delete_table(u'pyconkr_speaker')

        # Deleting model 'Program'
        db.delete_table(u'pyconkr_program')

        # Removing M2M table for field speakers on 'Program'
        db.delete_table(db.shorten_name(u'pyconkr_program_speakers'))

        # Removing M2M table for field times on 'Program'
        db.delete_table(db.shorten_name(u'pyconkr_program_times')) 
Example #10
Source File: 0008_auto__del_field_program_room.py    From pyconkr-2014 with MIT License 5 votes vote down vote up
def backwards(self, orm):

        # User chose to not deal with backwards NULL issues for 'Program.room'
        raise RuntimeError("Cannot reverse this migration. 'Program.room' and its values cannot be restored.")
        
        # The following code is provided here to aid in writing a correct migration        # Adding field 'Program.room'
        db.add_column(u'pyconkr_program', 'room',
                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pyconkr.Room']),
                      keep_default=False)

        # Removing M2M table for field rooms on 'Program'
        db.delete_table(db.shorten_name(u'pyconkr_program_rooms')) 
Example #11
Source File: 0008_auto__del_field_program_room.py    From pyconkr-2014 with MIT License 5 votes vote down vote up
def forwards(self, orm):
        # Deleting field 'Program.room'
        db.delete_column(u'pyconkr_program', 'room_id')

        # Adding M2M table for field rooms on 'Program'
        m2m_table_name = db.shorten_name(u'pyconkr_program_rooms')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('program', models.ForeignKey(orm[u'pyconkr.program'], null=False)),
            ('room', models.ForeignKey(orm[u'pyconkr.room'], null=False))
        ))
        db.create_unique(m2m_table_name, ['program_id', 'room_id']) 
Example #12
Source File: 0011_auto.py    From django-mmc with GNU General Public License v2.0 5 votes vote down vote up
def backwards(self, orm):
        # Removing M2M table for field ignore on 'MMCEmail'
        db.delete_table(db.shorten_name('mmc_mmcemail_ignore')) 
Example #13
Source File: 0011_auto.py    From django-mmc with GNU General Public License v2.0 5 votes vote down vote up
def forwards(self, orm):
        # Adding M2M table for field ignore on 'MMCEmail'
        m2m_table_name = db.shorten_name('mmc_mmcemail_ignore')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('mmcemail', models.ForeignKey(orm['mmc.mmcemail'], null=False)),
            ('mmcscript', models.ForeignKey(orm['mmc.mmcscript'], null=False))
        ))
        db.create_unique(m2m_table_name, ['mmcemail_id', 'mmcscript_id']) 
Example #14
Source File: 0003_auto__del_reference__add_sourceupdate__chg_field_source_uri__del_field.py    From scirius with GNU General Public License v3.0 5 votes vote down vote up
def backwards(self, orm):
        # Adding model 'Reference'
        db.create_table(u'rules_reference', (
            ('value', self.gf('django.db.models.fields.CharField')(max_length=1000)),
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('key', self.gf('django.db.models.fields.CharField')(max_length=100)),
        ))
        db.send_create_signal(u'rules', ['Reference'])

        # Deleting model 'SourceUpdate'
        db.delete_table(u'rules_sourceupdate')


        # Changing field 'Source.uri'
        db.alter_column(u'rules_source', 'uri', self.gf('django.db.models.fields.CharField')(default=1, max_length=400))
        # Adding field 'Rule.id'
        db.add_column(u'rules_rule', u'id',
                      self.gf('django.db.models.fields.AutoField')(default=1, primary_key=True),
                      keep_default=False)

        # Adding M2M table for field references on 'Rule'
        m2m_table_name = db.shorten_name(u'rules_rule_references')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('rule', models.ForeignKey(orm[u'rules.rule'], null=False)),
            ('reference', models.ForeignKey(orm[u'rules.reference'], null=False))
        ))
        db.create_unique(m2m_table_name, ['rule_id', 'reference_id'])


        # Changing field 'Rule.sid'
        db.alter_column(u'rules_rule', 'sid', self.gf('django.db.models.fields.IntegerField')(unique=True)) 
Example #15
Source File: 0028_auto__add_organization__add_field_documentsetformentry_organization__a.py    From crowdata with MIT License 5 votes vote down vote up
def forwards(self, orm):
        # Adding model 'Organization'
        db.create_table(u'crowdataapp_organization', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length='128')),
            ('description', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal(u'crowdataapp', ['Organization'])

        # Adding M2M table for field users on 'Organization'
        m2m_table_name = db.shorten_name(u'crowdataapp_organization_users')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('organization', models.ForeignKey(orm[u'crowdataapp.organization'], null=False)),
            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['organization_id', 'user_id'])

        # Adding field 'DocumentSetFormEntry.organization'
        db.add_column(u'crowdataapp_documentsetformentry', 'organization',
                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['crowdataapp.Organization'], null=True, blank=True),
                      keep_default=False)

        # Adding field 'UserProfile.current_organization'
        db.add_column(u'crowdataapp_userprofile', 'current_organization',
                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['crowdataapp.Organization'], null=True, blank=True),
                      keep_default=False) 
Example #16
Source File: 0006_auto__add_flowbit.py    From scirius with GNU General Public License v3.0 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'Flowbit'
        db.delete_table(u'rules_flowbit')

        # Removing M2M table for field flowbits on 'Rule'
        db.delete_table(db.shorten_name(u'rules_rule_flowbits')) 
Example #17
Source File: 0001_initial.py    From django-rest-authemail with GNU General Public License v3.0 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'MyUser'
        db.delete_table(u'accounts_myuser')

        # Removing M2M table for field groups on 'MyUser'
        db.delete_table(db.shorten_name(u'accounts_myuser_groups'))

        # Removing M2M table for field user_permissions on 'MyUser'
        db.delete_table(db.shorten_name(u'accounts_myuser_user_permissions')) 
Example #18
Source File: 0001_initial.py    From django-rest-authemail with GNU General Public License v3.0 5 votes vote down vote up
def forwards(self, orm):
        # Adding model 'MyUser'
        db.create_table(u'accounts_myuser', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('password', self.gf('django.db.models.fields.CharField')(max_length=128)),
            ('last_login', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('is_superuser', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('first_name', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
            ('last_name', self.gf('django.db.models.fields.CharField')(max_length=30, blank=True)),
            ('email', self.gf('django.db.models.fields.EmailField')(unique=True, max_length=255)),
            ('is_staff', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('date_joined', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('is_verified', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('date_of_birth', self.gf('django.db.models.fields.DateField')(null=True, blank=True)),
        ))
        db.send_create_signal(u'accounts', ['MyUser'])

        # Adding M2M table for field groups on 'MyUser'
        m2m_table_name = db.shorten_name(u'accounts_myuser_groups')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('myuser', models.ForeignKey(orm[u'accounts.myuser'], null=False)),
            ('group', models.ForeignKey(orm[u'auth.group'], null=False))
        ))
        db.create_unique(m2m_table_name, ['myuser_id', 'group_id'])

        # Adding M2M table for field user_permissions on 'MyUser'
        m2m_table_name = db.shorten_name(u'accounts_myuser_user_permissions')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('myuser', models.ForeignKey(orm[u'accounts.myuser'], null=False)),
            ('permission', models.ForeignKey(orm[u'auth.permission'], null=False))
        ))
        db.create_unique(m2m_table_name, ['myuser_id', 'permission_id']) 
Example #19
Source File: 0001_initial.py    From opensurfaces with MIT License 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'ShapeName'
        db.delete_table(u'shapes_shapename')

        # Deleting model 'ShapeSubstance'
        db.delete_table(u'shapes_shapesubstance')

        # Deleting model 'ShapeSubstanceGroup'
        db.delete_table(u'shapes_shapesubstancegroup')

        # Removing M2M table for field names on 'ShapeSubstanceGroup'
        db.delete_table(db.shorten_name(u'shapes_shapesubstancegroup_names'))

        # Deleting model 'MaterialShape'
        db.delete_table(u'shapes_materialshape')

        # Removing M2M table for field submitted_shapes on 'MaterialShape'
        db.delete_table(db.shorten_name(u'shapes_materialshape_submitted_shapes'))

        # Deleting model 'SubmittedShape'
        db.delete_table(u'shapes_submittedshape')

        # Deleting model 'ShapeSubstanceLabel'
        db.delete_table(u'shapes_shapesubstancelabel')

        # Deleting model 'MaterialShapeNameLabel'
        db.delete_table(u'shapes_materialshapenamelabel')

        # Deleting model 'ShapePlanarityLabel'
        db.delete_table(u'shapes_shapeplanaritylabel')

        # Deleting model 'MaterialShapeQuality'
        db.delete_table(u'shapes_materialshapequality')

        # Deleting model 'MaterialShapeNicenessLabel'
        db.delete_table(u'shapes_materialshapenicenesslabel') 
Example #20
Source File: 0008_auto_add_user_star_field_to_project.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def backwards(self, orm):
        # Removing M2M table for field user_stars on 'Project'
        db.delete_table(db.shorten_name(u'api_project_user_stars')) 
Example #21
Source File: 0008_auto_add_user_star_field_to_project.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def forwards(self, orm):
        # Adding M2M table for field user_stars on 'Project'
        m2m_table_name = db.shorten_name(u'api_project_user_stars')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('project', models.ForeignKey(orm['api.project'], null=False)),
            ('user', models.ForeignKey(orm[u'auth.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['project_id', 'user_id']) 
Example #22
Source File: 0028_auto__add_organization__add_field_documentsetformentry_organization__a.py    From crowdata with MIT License 5 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'Organization'
        db.delete_table(u'crowdataapp_organization')

        # Removing M2M table for field users on 'Organization'
        db.delete_table(db.shorten_name(u'crowdataapp_organization_users'))

        # Deleting field 'DocumentSetFormEntry.organization'
        db.delete_column(u'crowdataapp_documentsetformentry', 'organization_id')

        # Deleting field 'UserProfile.current_organization'
        db.delete_column(u'crowdataapp_userprofile', 'current_organization_id') 
Example #23
Source File: 0001_initial.py    From daywatch with MIT License 4 votes vote down vote up
def backwards(self, orm):
        # Deleting model 'Language'
        db.delete_table(u'core_language')

        # Deleting model 'Country'
        db.delete_table(u'core_country')

        # Deleting model 'Currency'
        db.delete_table(u'core_currency')

        # Deleting model 'UserProfile'
        db.delete_table(u'core_userprofile')

        # Removing M2M table for field country_access on 'UserProfile'
        db.delete_table(db.shorten_name(u'core_userprofile_country_access'))

        # Deleting model 'Category'
        db.delete_table(u'core_category')

        # Deleting model 'Site'
        db.delete_table(u'core_site')

        # Deleting model 'Merchant'
        db.delete_table(u'core_merchant')

        # Deleting model 'Item'
        db.delete_table(u'core_item')

        # Deleting model 'BufferedItem'
        db.delete_table(u'core_buffereditem')

        # Deleting model 'TestItem'
        db.delete_table(u'core_testitem')

        # Deleting model 'ActivityLog'
        db.delete_table(u'core_activitylog')

        # Deleting model 'ErrorLog'
        db.delete_table(u'core_errorlog')

        # Deleting model 'SoldCount'
        db.delete_table(u'core_soldcount')

        # Deleting model 'Run'
        db.delete_table(u'core_run')