1 # -*- coding: utf-8 -*-
4 from django
.db
import models
, migrations
5 from django
.conf
import settings
8 class Migration(migrations
.Migration
):
11 migrations
.swappable_dependency(settings
.AUTH_USER_MODEL
),
12 ('contenttypes', '0001_initial'),
16 migrations
.CreateModel(
19 ('id', models
.AutoField(
24 ('settings', models
.TextField(default
='{}')),
25 ('object_id', models
.UUIDField(
29 ('content_type', models
.ForeignKey(
31 to
='contenttypes.ContentType',
33 on_delete
=models
.PROTECT
,
35 ('user', models
.ForeignKey(
36 to
=settings
.AUTH_USER_MODEL
,
37 on_delete
=models
.CASCADE
,
42 bases
=(models
.Model
,),
44 migrations
.AlterUniqueTogether(
46 unique_together
=set([('user', 'content_type', 'object_id')]),
48 # PostgreSQL does not consider null values for unique constraints;
49 # UserSettings for Users have no content_object; the following ensures
50 # there can only be one such entry per user
52 [('CREATE UNIQUE INDEX usersettings_unique_null '
53 'ON usersettings_usersettings (user_id) '
54 'WHERE content_type_id IS NULL;', None)],
55 [('DROP INDEX IF EXISTS usersettings_unique_null;', None)],