Commits

Patrick Guido Arminio committed bc6bd38

Aggiungo unique al dispositivo.

  • Participants
  • Parent commits 66a34b8

Comments (0)

Files changed (2)

File projectmensa/menu/migrations/0015_auto__add_unique_device_key.py

+# encoding: 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 unique constraint on 'Device', fields ['key']
+        db.create_unique('menu_device', ['key'])
+
+
+    def backwards(self, orm):
+        
+        # Removing unique constraint on 'Device', fields ['key']
+        db.delete_unique('menu_device', ['key'])
+
+
+    models = {
+        'menu.course': {
+            'Meta': {'object_name': 'Course'},
+            'alternative_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
+            'type': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'menu.device': {
+            'Meta': {'object_name': 'Device'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'})
+        },
+        'menu.menuoftheday': {
+            'Meta': {'object_name': 'MenuOfTheDay'},
+            'courses': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['menu.Course']", 'null': 'True', 'blank': 'True'}),
+            'day': ('django.db.models.fields.DateField', [], {'default': 'datetime.date(2012, 11, 29)', 'unique': 'True'}),
+            'downloaded_from': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+            'published': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
+        },
+        'menu.typetoken': {
+            'Meta': {'object_name': 'TypeToken'},
+            'description': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'regex': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'token': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
+            'type': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['menu']

File projectmensa/menu/models.py

 
 
 class Device(models.Model):
-    key = models.CharField(max_length=200)
+    key = models.CharField(max_length=200, unique=True)
 
     class Meta(object):
         verbose_name = _('Dispositivo')