• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python db.create_unique函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中south.db.db.create_unique函数的典型用法代码示例。如果您正苦于以下问题:Python create_unique函数的具体用法?Python create_unique怎么用?Python create_unique使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_unique函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: forwards

    def forwards(self, orm):
        # Adding model 'User'
        db.create_table('auth_user', (
            (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)),
            ('username', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
            ('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')(max_length=75, blank=True)),
            ('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)),
        ))
        db.send_create_signal(u'accounts', ['User'])

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

        # Adding M2M table for field user_permissions on 'User'
        m2m_table_name = db.shorten_name('auth_user_user_permissions')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('user', models.ForeignKey(orm[u'accounts.user'], null=False)),
            ('permission', models.ForeignKey(orm[u'auth.permission'], null=False))
        ))
        db.create_unique(m2m_table_name, ['user_id', 'permission_id'])
开发者ID:JesusAnaya,项目名称:pythonbc.com,代码行数:34,代码来源:0001_initial.py


示例2: forwards

    def forwards(self, orm):
        # Adding field 'Profile.subscribe_any_translation'
        db.add_column('accounts_profile', 'subscribe_any_translation',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'Profile.subscribe_new_string'
        db.add_column('accounts_profile', 'subscribe_new_string',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'Profile.subscribe_new_suggestion'
        db.add_column('accounts_profile', 'subscribe_new_suggestion',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding field 'Profile.subscribe_new_contributor'
        db.add_column('accounts_profile', 'subscribe_new_contributor',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

        # Adding M2M table for field subscriptions on 'Profile'
        db.create_table('accounts_profile_subscriptions', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('profile', models.ForeignKey(orm['accounts.profile'], null=False)),
            ('project', models.ForeignKey(orm['trans.project'], null=False))
        ))
        db.create_unique('accounts_profile_subscriptions', ['profile_id', 'project_id'])
开发者ID:lohrun,项目名称:weblate,代码行数:28,代码来源:0002_subscriptions.py


示例3: forwards

    def forwards(self, orm):
        # Adding model 'User'
        db.create_table(u'rt_user_user', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('username', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
            ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('modified_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
        ))
        db.send_create_signal(u'rt_user', ['User'])

        # Adding model 'Group'
        db.create_table(u'rt_user_group', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('modified_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
        ))
        db.send_create_signal(u'rt_user', ['Group'])

        # Adding M2M table for field members on 'Group'
        m2m_table_name = db.shorten_name(u'rt_user_group_members')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('group', models.ForeignKey(orm[u'rt_user.group'], null=False)),
            ('user', models.ForeignKey(orm[u'rt_user.user'], null=False))
        ))
        db.create_unique(m2m_table_name, ['group_id', 'user_id'])
开发者ID:kipe,项目名称:RT,代码行数:29,代码来源:0001_initial.py


示例4: forwards

    def forwards(self, orm):
        # Adding model 'Poll'
        db.create_table(u'polls_poll', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('question', self.gf('django.db.models.fields.CharField')(max_length=200)),
            ('pub_date', self.gf('django.db.models.fields.DateTimeField')()),
        ))
        db.send_create_signal(u'polls', ['Poll'])

        # Adding model 'Voter'
        db.create_table(u'polls_voter', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('voterID', self.gf('django.db.models.fields.CharField')(max_length=200)),
        ))
        db.send_create_signal(u'polls', ['Voter'])

        # Adding model 'Choice'
        db.create_table(u'polls_choice', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('poll', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polls.Poll'])),
            ('choice_text', self.gf('django.db.models.fields.CharField')(max_length=200)),
            ('votes', self.gf('django.db.models.fields.IntegerField')(default=0)),
        ))
        db.send_create_signal(u'polls', ['Choice'])

        # Adding M2M table for field voters on 'Choice'
        m2m_table_name = db.shorten_name(u'polls_choice_voters')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('choice', models.ForeignKey(orm[u'polls.choice'], null=False)),
            ('voter', models.ForeignKey(orm[u'polls.voter'], null=False))
        ))
        db.create_unique(m2m_table_name, ['choice_id', 'voter_id'])
开发者ID:shiqli,项目名称:mysite,代码行数:33,代码来源:0001_initial.py


示例5: forwards

    def forwards(self, orm):
        
        # Deleting field 'LegAction.minutes'
        db.delete_column('phillyleg_legaction', 'minutes_id')

        # Adding unique constraint on 'LegMinutes', fields ['id']
        db.create_unique('phillyleg_legminutes', ['id'])
开发者ID:Alexander-M-Waldman,项目名称:councilmatic,代码行数:7,代码来源:0011_auto__del_field_legaction_minutes__add_field_legaction_minutes_tmpid__.py


示例6: backwards

    def backwards(self, orm):
        
        # Changing field 'Task.model_solution'
        db.alter_column('tasks_task', 'model_solution_id', self.gf('django.db.models.fields.related.OneToOneField')(unique=True, null=True, to=orm['solutions.Solution']))

        # Adding unique constraint on 'Task', fields ['model_solution']
        db.create_unique('tasks_task', ['model_solution_id'])
开发者ID:juliushaertl,项目名称:Praktomat,代码行数:7,代码来源:0005_auto__chg_field_task_model_solution__del_unique_task_model_solution.py


示例7: forwards

    def forwards(self, orm):
        
        # Deleting model 'NodeProductReports'
        db.delete_table('ilsgateway_nodeproductreports')

        # Adding model 'NodeProductReport'
        db.create_table('ilsgateway_nodeproductreport', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('product', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ilsgateway.Product'])),
            ('node', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ilsgateway.Node'])),
            ('report_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['ilsgateway.ProductReportType'])),
            ('quantity', self.gf('django.db.models.fields.IntegerField')()),
        ))
        db.send_create_signal('ilsgateway', ['NodeProductReport'])

        # Removing M2M table for field child_nodes on 'Node'
        db.delete_table('ilsgateway_node_child_nodes')

        # Adding M2M table for field child_node on 'Node'
        db.create_table('ilsgateway_node_child_node', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('from_node', models.ForeignKey(orm['ilsgateway.node'], null=False)),
            ('to_node', models.ForeignKey(orm['ilsgateway.node'], null=False))
        ))
        db.create_unique('ilsgateway_node_child_node', ['from_node_id', 'to_node_id'])
开发者ID:adothompson,项目名称:rapidsms-ilsgateway-app,代码行数:25,代码来源:0013_auto__del_nodeproductreports__add_nodeproductreport.py


示例8: forwards

    def forwards(self, orm):
        # Deleting field 'SponsorshipLevel.content_type'
        db.delete_column(u'camp_sponsorshiplevel', 'content_type_id')

        # Deleting field 'SponsorshipLevel.object_id'
        db.delete_column(u'camp_sponsorshiplevel', 'object_id')

        # Adding M2M table for field events on 'SponsorshipLevel'
        db.create_table(u'camp_sponsorshiplevel_events', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('sponsorshiplevel', models.ForeignKey(orm[u'camp.sponsorshiplevel'], null=False)),
            ('event', models.ForeignKey(orm[u'sked.event'], null=False))
        ))
        db.create_unique(u'camp_sponsorshiplevel_events', ['sponsorshiplevel_id', 'event_id'])

        # Deleting field 'Sponsor.content_type'
        db.delete_column(u'camp_sponsor', 'content_type_id')

        # Deleting field 'Sponsor.object_id'
        db.delete_column(u'camp_sponsor', 'object_id')

        # Adding field 'Sponsor.event'
        db.add_column(u'camp_sponsor', 'event',
                      self.gf('django.db.models.fields.related.ForeignKey')(default=1, related_name='sponsors', to=orm['sked.Event']),
                      keep_default=False)
开发者ID:andergmartins,项目名称:tcamp,代码行数:25,代码来源:0003_auto__del_field_sponsorshiplevel_content_type__del_field_sponsorshiple.py


示例9: backwards

    def backwards(self, orm):
        
        # Adding field 'SMARTTest.smarttest_disk'
        db.add_column('system_smarttest', 'smarttest_disk', self.gf('django.db.models.fields.related.ForeignKey')(default=1, related_name='smarttestdisk', to=orm['storage.Disk']), keep_default=False)

        # Adding unique constraint on 'SMARTTest', fields ['smarttest_type', 'smarttest_disk']
        db.create_unique('system_smarttest', ['smarttest_type', 'smarttest_disk_id'])
开发者ID:650elx,项目名称:middleware,代码行数:7,代码来源:0039_auto__del_field_smarttest_smarttest_disk__del_unique_smarttest_smartte.py


示例10: forwards

    def forwards(self, orm):
        # Deleting model 'SkipQuestion'
        db.delete_table(u'questionnaire_skipquestion')

        # Adding model 'MultipleResponseAnswer'
        db.create_table(u'questionnaire_multipleresponseanswer', (
            (u'answer_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['questionnaire.Answer'], unique=True, primary_key=True)),
        ))
        db.send_create_signal('questionnaire', ['MultipleResponseAnswer'])

        # Adding M2M table for field response on 'MultipleResponseAnswer'
        db.create_table(u'questionnaire_multipleresponseanswer_response', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('multipleresponseanswer', models.ForeignKey(orm['questionnaire.multipleresponseanswer'], null=False)),
            ('questionoption', models.ForeignKey(orm['questionnaire.questionoption'], null=False))
        ))
        db.create_unique(u'questionnaire_multipleresponseanswer_response', ['multipleresponseanswer_id', 'questionoption_id'])

        # Adding model 'SkipRule'
        db.create_table(u'questionnaire_skiprule', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, blank=True)),
            ('modified', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, blank=True)),
            ('root_question', self.gf('django.db.models.fields.related.ForeignKey')(related_name='root_skip_rules', to=orm['questionnaire.Question'])),
            ('response', self.gf('django.db.models.fields.related.ForeignKey')(related_name='skip_rules', to=orm['questionnaire.QuestionOption'])),
            ('skip_question', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='skip_rules', null=True, to=orm['questionnaire.Question'])),
            ('skip_subsection', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['questionnaire.SubSection'], null=True, blank=True)),
            ('subsection', self.gf('django.db.models.fields.related.ForeignKey')(related_name='skip_rules', to=orm['questionnaire.SubSection'])),
        ))
        db.send_create_signal('questionnaire', ['SkipRule'])
开发者ID:tomclement,项目名称:ejrf,代码行数:30,代码来源:0069_auto__del_skipquestion__add_multipleresponseanswer__add_skiprule.py


示例11: forwards

    def forwards(self, orm):
        # Adding model 'Collection'
        db.create_table('collection_collection', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
            ('owner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('creation_date', self.gf('django.db.models.fields.DateTimeField')()),
            ('modified_date', self.gf('django.db.models.fields.DateTimeField')()),
            ('is_public', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('is_locked', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['collection.Collection'], null=True, blank=True)),
            ('creation_info', self.gf('django.db.models.fields.CharField')(max_length=200)),
        ))
        db.send_create_signal('collection', ['Collection'])

        # Adding unique constraint on 'Collection', fields ['owner', 'name']
        db.create_unique('collection_collection', ['owner_id', 'name'])

        # Adding M2M table for field images on 'Collection'
        db.create_table('collection_collection_images', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('collection', models.ForeignKey(orm['collection.collection'], null=False)),
            ('image', models.ForeignKey(orm['catamidb.image'], null=False))
        ))
        db.create_unique('collection_collection_images', ['collection_id', 'image_id'])
开发者ID:acfrmarine,项目名称:squidle,代码行数:26,代码来源:0001_initial.py


示例12: forwards

    def forwards(self, orm):
        
        # Adding model 'RaceSpeed'
        db.create_table('dnd_racespeed', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['dnd.RaceSpeedType'])),
            ('speed', self.gf('django.db.models.fields.PositiveSmallIntegerField')()),
        ))
        db.send_create_signal('dnd', ['RaceSpeed'])

        # Adding model 'RaceSpeedType'
        db.create_table('dnd_racespeedtype', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=32, db_index=True)),
            ('extra', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
        ))
        db.send_create_signal('dnd', ['RaceSpeedType'])

        # Deleting field 'Race.base_land_speed'
        db.delete_column('dnd_race', 'base_land_speed')

        # Adding field 'Race.combat'
        db.add_column('dnd_race', 'combat', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)

        # Adding M2M table for field speeds on 'Race'
        db.create_table('dnd_race_speeds', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('race', models.ForeignKey(orm['dnd.race'], null=False)),
            ('racespeed', models.ForeignKey(orm['dnd.racespeed'], null=False))
        ))
        db.create_unique('dnd_race_speeds', ['race_id', 'racespeed_id'])
开发者ID:Aaron-M-Hill,项目名称:dndtools,代码行数:31,代码来源:0046_auto__add_racespeed__add_racespeedtype__del_field_race_base_land_speed.py


示例13: forwards

    def forwards(self, orm):
        # Adding model 'DesLookbook'
        db.create_table(u'catalogue_deslookbook', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('designer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['designer.Designer'], null=True, blank=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128, unique=True, null=True)),
            ('description', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal(u'catalogue', ['DesLookbook'])

        # Adding M2M table for field products on 'DesLookbook'
        m2m_table_name = db.shorten_name(u'catalogue_deslookbook_products')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('deslookbook', models.ForeignKey(orm[u'catalogue.deslookbook'], null=False)),
            ('product', models.ForeignKey(orm[u'catalogue.product'], null=False))
        ))
        db.create_unique(m2m_table_name, ['deslookbook_id', 'product_id'])

        # Adding field 'Product.designer'
        db.add_column(u'catalogue_product', 'designer',
                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['designer.Designer'], null=True, blank=True),
                      keep_default=False)

        # Adding field 'Product.video'
        db.add_column(u'catalogue_product', 'video',
                      self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True),
                      keep_default=False)
开发者ID:AjitHimself,项目名称:Houseofhaus,代码行数:28,代码来源:0024_auto__add_deslookbook__add_field_product_designer__add_field_product_v.py


示例14: forwards

    def forwards(self, orm):
        
        # Adding model 'EntryTranslation'
        db.create_table('happy_blog_entry_translation', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('slug', self.gf('django.db.models.fields.CharField')(max_length=256)),
            ('content', self.gf('tinymce.models.HTMLField')(blank=True)),
            ('language_code', self.gf('django.db.models.fields.CharField')(max_length=15, db_index=True)),
            ('master', self.gf('django.db.models.fields.related.ForeignKey')(related_name='translatable', null=True, to=orm['happy_blog.Entry'])),
        ))
        db.send_create_signal('happy_blog', ['EntryTranslation'])

        # Adding unique constraint on 'EntryTranslation', fields ['language_code', 'master']
        db.create_unique('happy_blog_entry_translation', ['language_code', 'master_id'])

        # Adding model 'Entry'
        db.create_table('happy_blog_entry', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('pub_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('published', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
            ('gallery', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['simplegallery.Gallery'], null=True, blank=True)),
        ))
        db.send_create_signal('happy_blog', ['Entry'])

        # Adding model 'LatestBlogEntriesPlugin'
        db.create_table('cmsplugin_latestblogentriesplugin', (
            ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
            ('count', self.gf('django.db.models.fields.IntegerField')(default=25)),
        ))
        db.send_create_signal('happy_blog', ['LatestBlogEntriesPlugin'])
开发者ID:alesdotio,项目名称:happy-blog,代码行数:32,代码来源:0001_initial.py


示例15: forwards

    def forwards(self, orm):
        
        # Deleting field 'Project.private'
        db.delete_column('gitlog_project', 'private')

        # Deleting field 'Project.source'
        db.delete_column('gitlog_project', 'source')

        # Adding field 'Project.public'
        db.add_column('gitlog_project', 'public', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)

        # Adding field 'Project.url'
        db.add_column('gitlog_project', 'url', self.gf('django.db.models.fields.URLField')(max_length=30, null=True, blank=True), keep_default=False)

        # Adding field 'Project.description'
        db.add_column('gitlog_project', 'description', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)

        # Adding M2M table for field writable on 'Project'
        db.create_table('gitlog_project_writable', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('project', models.ForeignKey(orm['gitlog.project'], null=False)),
            ('user', models.ForeignKey(orm['auth.user'], null=False))
        ))
        db.create_unique('gitlog_project_writable', ['project_id', 'user_id'])

        # Adding M2M table for field readonly on 'Project'
        db.create_table('gitlog_project_readonly', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('project', models.ForeignKey(orm['gitlog.project'], null=False)),
            ('user', models.ForeignKey(orm['auth.user'], null=False))
        ))
        db.create_unique('gitlog_project_readonly', ['project_id', 'user_id'])

        # Changing field 'Project.owner'
        db.alter_column('gitlog_project', 'owner_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['auth.User']))
开发者ID:masarliev,项目名称:gitlog,代码行数:35,代码来源:0002_auto__del_field_project_private__del_field_project_source__add_field_p.py


示例16: forwards

    def forwards(self, orm):
        # Adding model 'Achievement'
        db.create_table('attestation_achievement', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
        ))
        db.send_create_signal('attestation', ['Achievement'])

        # Deleting field 'Request.degree'
        db.delete_column('attestation_request', 'degree_id')

        # Adding M2M table for field degrees on 'Request'
        db.create_table('attestation_request_degrees', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('request', models.ForeignKey(orm['attestation.request'], null=False)),
            ('degree', models.ForeignKey(orm['attestation.degree'], null=False))
        ))
        db.create_unique('attestation_request_degrees', ['request_id', 'degree_id'])

        # Adding M2M table for field achievements on 'Request'
        db.create_table('attestation_request_achievements', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('request', models.ForeignKey(orm['attestation.request'], null=False)),
            ('achievement', models.ForeignKey(orm['attestation.achievement'], null=False))
        ))
        db.create_unique('attestation_request_achievements', ['request_id', 'achievement_id'])
开发者ID:ClearMind,项目名称:doin,代码行数:26,代码来源:0027_auto__add_achievement__del_field_request_degree.py


示例17: forwards

    def forwards(self, orm):
        
        # Adding model 'Message'
        db.create_table('txtmessages_message', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
            ('to_type', self.gf('django.db.models.fields.CharField')(default='Everyone', max_length=64)),
            ('message', self.gf('django.db.models.fields.TextField')()),
            ('sent', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('time_sent', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
            ('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
        ))
        db.send_create_signal('txtmessages', ['Message'])

        # Adding M2M table for field custom on 'Message'
        db.create_table('txtmessages_message_custom', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('message', models.ForeignKey(orm['txtmessages.message'], null=False)),
            ('pledge', models.ForeignKey(orm['pledge.pledge'], null=False))
        ))
        db.create_unique('txtmessages_message_custom', ['message_id', 'pledge_id'])

        # Adding model 'Status'
        db.create_table('txtmessages_status', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('message', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['txtmessages.Message'])),
            ('receiver', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pledge.Pledge'])),
            ('sid', self.gf('django.db.models.fields.CharField')(max_length=64)),
            ('status', self.gf('django.db.models.fields.CharField')(default='Queued', max_length=64)),
        ))
        db.send_create_signal('txtmessages', ['Status'])
开发者ID:jasonshim,项目名称:Txtocracy,代码行数:32,代码来源:0001_initial.py


示例18: backwards

    def backwards(self, orm):
        # Adding M2M table for field comment on 'Event'
        m2m_table_name = db.shorten_name(u'event_event_comment')
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('event', models.ForeignKey(orm[u'event.event'], null=False)),
            ('comment', models.ForeignKey(orm[u'comment.comment'], null=False))
        ))
        db.create_unique(m2m_table_name, ['event_id', 'comment_id'])


        # Changing field 'Event.category'
        db.alter_column(u'event_event', 'category_id', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['event.EventCategory']))

        # Changing field 'Event.fr'
        db.alter_column(u'event_event', 'fr', self.gf('django.db.models.fields.DateTimeField')(default=1))

        # Changing field 'Event.cover'
        db.alter_column(u'event_event', 'cover', self.gf('django.db.models.fields.files.ImageField')(default=1, max_length=100))

        # Changing field 'Event.to'
        db.alter_column(u'event_event', 'to', self.gf('django.db.models.fields.DateTimeField')(default=1))

        # Changing field 'Event.place'
        db.alter_column(u'event_event', 'place', self.gf('django.db.models.fields.CharField')(default=1, max_length=250))
开发者ID:neudesk,项目名称:20thst,代码行数:25,代码来源:0015_auto__chg_field_event_category__chg_field_event_fr__chg_field_event_co.py


示例19: backwards

    def backwards(self, orm):
        # Adding model 'Customer'
        db.create_table(u'attendees_customer', (
            ('conference', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['conference.Conference'], null=True, on_delete=models.PROTECT)),
            ('is_exported', self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('email', self.gf('django.db.models.fields.EmailField')(max_length=250)),
            ('date_added', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
            ('customer_number', self.gf('django.db.models.fields.IntegerField')(blank=True)),
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
        ))
        db.send_create_signal(u'attendees', ['Customer'])

        # Adding unique constraint on 'Customer', fields ['customer_number', 'conference']
        db.create_unique(u'attendees_customer', ['customer_number', 'conference_id'])


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

        # Deleting field 'Purchase.email'
        db.delete_column(u'attendees_purchase', 'email')
开发者ID:DanielSzoska,项目名称:djep,代码行数:26,代码来源:0012_auto__del_customer__del_unique_customer_customer_number_conference__de.py


示例20: forwards

    def forwards(self, orm):
        
        # Adding model 'Category'
        db.create_table('yadba_category', (
            ('description', self.gf('django.db.models.fields.TextField')()),
            ('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('yadba', ['Category'])

        # Adding model 'Entry'
        db.create_table('yadba_entry', (
            ('body', self.gf('django.db.models.fields.TextField')()),
            ('tags', self.gf('tagging.fields.TagField')(default='')),
            ('date_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('date_posted', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
        ))
        db.send_create_signal('yadba', ['Entry'])

        # Adding M2M table for field categories on 'Entry'
        db.create_table('yadba_entry_categories', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('entry', models.ForeignKey(orm['yadba.entry'], null=False)),
            ('category', models.ForeignKey(orm['yadba.category'], null=False))
        ))
        db.create_unique('yadba_entry_categories', ['entry_id', 'category_id'])
开发者ID:wraithan,项目名称:ltt_blog,代码行数:28,代码来源:0001_initial.py



注:本文中的south.db.db.create_unique函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python db.delete_column函数代码示例发布时间:2022-05-27
下一篇:
Python db.create_table函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap