Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add private meta field to User

Jakub Draganek708d284170f0
diff --git a/saleor/account/migrations/0028_user_private_meta.py b/saleor/account/migrations/0028_user_private_meta.py
new file mode 100644
index 0000000000..f1629efbe8
--- /dev/null
+++ b/saleor/account/migrations/0028_user_private_meta.py
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.1 on 2019-05-31 10:44
+
+import django.contrib.postgres.fields.jsonb
+from django.db import migrations
+import saleor.core.utils.json_serializer
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0027_customerevent'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='user',
+ name='private_meta',
+ field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, encoder=saleor.core.utils.json_serializer.CustomJsonEncoder),
+ ),
+ ]
diff --git a/saleor/account/models.py b/saleor/account/models.py
index a7c59af318..aad16ed5a0 100644
--- a/saleor/account/models.py
+++ b/saleor/account/models.py
@@ -151,6 +151,8 @@ class User(PermissionsMixin, AbstractBaseUser):
)
avatar = VersatileImageField(upload_to="user-avatars", blank=True, null=True)
+ private_meta = JSONField(blank=True, default=dict, encoder=CustomJsonEncoder)
+
USERNAME_FIELD = "email"
objects = UserManager()