本文整理汇总了Python中south.db.db.create_unique方法的典型用法代码示例。如果您正苦于以下问题:Python db.create_unique方法的具体用法?Python db.create_unique怎么用?Python db.create_unique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类south.db.db
的用法示例。
在下文中一共展示了db.create_unique方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding model 'Project'
db.create_table('api_project', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
('organization', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_organization', to=orm['auth.User'])),
('created_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_creator', to=orm['auth.User'])),
('date_created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('date_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
))
db.send_create_signal('api', ['Project'])
# Adding unique constraint on 'Project', fields ['name', 'organization']
db.create_unique('api_project', ['name', 'organization_id'])
# Adding M2M table for field projects on 'Team'
db.create_table('api_team_projects', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('team', models.ForeignKey(orm['api.team'], null=False)),
('project', models.ForeignKey(orm['api.project'], null=False))
))
db.create_unique('api_team_projects', ['team_id', 'project_id'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:24,代码来源:0002_auto__add_project__add_unique_project_name_organization.py
示例2: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding model 'Event'
db.create_table(u'socialnetwork_event', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['backoffice.Event'])),
('name', self.gf('django.db.models.fields.CharField')(max_length=10)),
('sn_id', self.gf('django.db.models.fields.CharField')(max_length=30)),
))
db.send_create_signal(u'socialnetwork', ['Event'])
# Adding unique constraint on 'Event', fields ['event', 'name']
db.create_unique(u'socialnetwork_event', ['event_id', 'name'])
# Adding model 'EventLog'
db.create_table(u'socialnetwork_eventlog', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('eventlog', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['backoffice.EventLog'])),
('name', self.gf('django.db.models.fields.CharField')(max_length=10)),
('sn_id', self.gf('django.db.models.fields.CharField')(max_length=30)),
))
db.send_create_signal(u'socialnetwork', ['EventLog'])
# Adding unique constraint on 'EventLog', fields ['eventlog', 'name']
db.create_unique(u'socialnetwork_eventlog', ['eventlog_id', 'name'])
示例3: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
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'])
示例4: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding model 'DashboardWidgetLastUpdate'
db.create_table(u'dashboard_app_dashboardwidgetlastupdate', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('widget_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128)),
('last_update', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, auto_now_add=True, blank=True)),
))
db.send_create_signal(u'dashboard_app', ['DashboardWidgetLastUpdate'])
# Adding model 'DashboardWidgetSettings'
db.create_table(u'dashboard_app_dashboardwidgetsettings', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('widget_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('setting_name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('value', self.gf('django.db.models.fields.CharField')(max_length=4000)),
))
db.send_create_signal(u'dashboard_app', ['DashboardWidgetSettings'])
# Adding unique constraint on 'DashboardWidgetSettings', fields ['widget_name', 'setting_name']
db.create_unique(u'dashboard_app_dashboardwidgetsettings', ['widget_name', 'setting_name'])
示例5: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
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)
开发者ID:crowdata,项目名称:crowdata,代码行数:29,代码来源:0028_auto__add_organization__add_field_documentsetformentry_organization__a.py
示例6: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding unique constraint on 'MySecondModel', fields ['name']
db.create_unique('test_app_mysecondmodel', ['name'])
开发者ID:plumdog,项目名称:django_migration_testcase,代码行数:5,代码来源:0007_auto__add_unique_mysecondmodel_name.py
示例7: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding unique constraint on 'MetaData', fields ['xform', 'data_type', 'data_value']
M = orm['main.metadata']
for x in M.objects.all():
dupes = M.objects.filter(xform_id=x.xform_id, data_type=x.data_type, data_value=x.data_value)
if dupes.count() > 1:
for dupe in dupes[1:]:
print 'Deleting duplicate MetaData', dupe.xform_id, dupe.data_type, dupe.data_value
dupe.delete()
partial_dupes = M.objects.filter(xform_id=x.xform_id, data_type=x.data_type)
if partial_dupes.count() > 1:
print 'Partially duplicate MetaData{}'.format('\n\t'.join(map(str, partial_dupes.values_list('xform_id', 'data_type', 'data_value'))))
db.create_unique(u'main_metadata', ['xform_id', 'data_type', 'data_value'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:16,代码来源:0012_auto__add_unique_metadata_xform_data_type_data_value.py
示例8: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding model 'ProjectXForm'
db.create_table('api_projectxform', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('xform', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['logger.XForm'])),
('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['api.Project'])),
('created_by', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
))
db.send_create_signal('api', ['ProjectXForm'])
# Adding unique constraint on 'ProjectXForm', fields ['xform', 'project']
db.create_unique('api_projectxform', ['xform_id', 'project_id'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:14,代码来源:0003_auto__add_projectxform__add_unique_projectxform_xform_project.py
示例9: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
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'])
示例10: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Changing field 'XForm.sms_id_string'
db.alter_column('odk_logger_xform', 'sms_id_string', self.gf('django.db.models.fields.SlugField')(max_length=50))
# Adding unique constraint on 'XForm', fields ['sms_id_string', 'user']
db.create_unique('odk_logger_xform', ['sms_id_string', 'user_id'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:8,代码来源:0026_auto__chg_field_xform_sms_id_string__add_unique_xform_sms_id_string_us.py
示例11: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Removing unique constraint on 'XForm', fields ['id_string']
db.delete_unique('odk_logger_xform', ['id_string'])
# Adding unique constraint on 'XForm', fields ['id_string', 'user']
db.create_unique('odk_logger_xform', ['id_string', 'user_id'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:9,代码来源:0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py
示例12: backwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def backwards(self, orm):
# Removing unique constraint on 'XForm', fields ['id_string', 'user']
db.delete_unique('odk_logger_xform', ['id_string', 'user_id'])
# Adding unique constraint on 'XForm', fields ['id_string']
db.create_unique('odk_logger_xform', ['id_string'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:9,代码来源:0002_auto__del_unique_xform_id_string__add_unique_xform_id_string_user.py
示例13: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding unique constraint on 'RestService', fields ['service_url', 'name', 'xform']
db.create_unique('restservice_restservice', ['service_url', 'name', 'xform_id'])
开发者ID:awemulya,项目名称:kobo-predict,代码行数:6,代码来源:0002_auto__add_unique_restservice_service_url_name_xform.py
示例14: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
def forwards(self, orm):
# Adding unique constraint on 'Export', fields ['filename', 'xform']
db.create_unique('odk_viewer_export', ['filename', 'xform_id'])
示例15: forwards
# 需要导入模块: from south.db import db [as 别名]
# 或者: from south.db.db import create_unique [as 别名]
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'])