diff options
author | Leif Johansson <leifj@sunet.se> | 2012-10-31 21:58:52 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-10-31 21:58:52 +0100 |
commit | 7e899faf1b3e558e3f6cbb690a84d5ba21ae8661 (patch) | |
tree | ffef13a5990480b36b1cf56b71a210f7c330cfc2 /meetingtools/apps | |
parent | 6158037e16f8aaa96b046df37718c9e234d1f214 (diff) |
uniqueness constraint on urlpath needs to be done in code
first remove it - then we'll add it back using verify_unique
and a prefix to encode the cluster
Diffstat (limited to 'meetingtools/apps')
-rw-r--r-- | meetingtools/apps/room/migrations/0002_auto__del_unique_room_urlpath.py | 98 | ||||
-rw-r--r-- | meetingtools/apps/room/models.py | 2 |
2 files changed, 99 insertions, 1 deletions
diff --git a/meetingtools/apps/room/migrations/0002_auto__del_unique_room_urlpath.py b/meetingtools/apps/room/migrations/0002_auto__del_unique_room_urlpath.py new file mode 100644 index 0000000..6577c99 --- /dev/null +++ b/meetingtools/apps/room/migrations/0002_auto__del_unique_room_urlpath.py @@ -0,0 +1,98 @@ +# -*- 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): + # Removing unique constraint on 'Room', fields ['urlpath'] + db.delete_unique('room_room', ['urlpath']) + + + def backwards(self, orm): + # Adding unique constraint on 'Room', fields ['urlpath'] + db.create_unique('room_room', ['urlpath']) + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'cluster.accluster': { + 'Meta': {'object_name': 'ACCluster'}, + 'api_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), + 'default_template_sco_id': ('django.db.models.fields.IntegerField', [], {'unique': 'True', 'blank': 'True'}), + 'domain_match': ('django.db.models.fields.TextField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), + 'user': ('django.db.models.fields.CharField', [], {'max_length': '128'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'room.room': { + 'Meta': {'unique_together': "(('name', 'folder_sco'),)", 'object_name': 'Room'}, + 'allow_host': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), + 'deleted_sco': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'deleted'", 'null': 'True', 'to': "orm['sco.ACObject']"}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'folder_sco': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'folders'", 'null': 'True', 'to': "orm['sco.ACObject']"}), + 'host_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'lastupdated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'lastvisited': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'sco': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sco.ACObject']", 'null': 'True'}), + 'self_cleaning': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source_sco': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sources'", 'null': 'True', 'to': "orm['sco.ACObject']"}), + 'timecreated': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'urlpath': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'sco.acobject': { + 'Meta': {'unique_together': "(('acc', 'sco_id'),)", 'object_name': 'ACObject'}, + 'acc': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cluster.ACCluster']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'lastupdated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'sco_id': ('django.db.models.fields.IntegerField', [], {}), + 'timecreated': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['room']
\ No newline at end of file diff --git a/meetingtools/apps/room/models.py b/meetingtools/apps/room/models.py index 29fe1c7..86acbc4 100644 --- a/meetingtools/apps/room/models.py +++ b/meetingtools/apps/room/models.py @@ -48,7 +48,7 @@ class Room(models.Model): folder_sco = ForeignKey(ACObject,null=True,related_name="folders") source_sco = ForeignKey(ACObject,null=True,related_name="sources") deleted_sco = ForeignKey(ACObject,null=True,related_name="deleted") - urlpath = CharField(verbose_name="Custom URL",max_length=128,unique=True) + urlpath = CharField(verbose_name="Custom URL",max_length=128) self_cleaning = BooleanField(verbose_name="Clean-up when empty?") allow_host = BooleanField(verbose_name="Allow first participant to become host?",default=True) description = TextField(blank=True,null=True) |