From 0a9809e6b3f7877854cf25ddf8706b2b62c1d3d1 Mon Sep 17 00:00:00 2001
From: Mouse Reeve
Date: Mon, 5 Oct 2020 14:48:26 -0700
Subject: [PATCH] Email should *not* be unique
turns out this is jank-city when you try to federate
---
bookwyrm/forms.py | 2 +-
bookwyrm/migrations/0052_auto_20201005_2145.py | 18 ++++++++++++++++++
bookwyrm/models/user.py | 1 -
bookwyrm/templates/edit_user.html | 7 +++++++
bookwyrm/view_actions.py | 1 +
5 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 bookwyrm/migrations/0052_auto_20201005_2145.py
diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py
index ee6a5667..7b18a2ff 100644
--- a/bookwyrm/forms.py
+++ b/bookwyrm/forms.py
@@ -99,7 +99,7 @@ class EditUserForm(CustomForm):
class Meta:
model = models.User
fields = [
- 'avatar', 'name', 'summary', 'manually_approves_followers'
+ 'avatar', 'name', 'email', 'summary', 'manually_approves_followers'
]
help_texts = {f: None for f in fields}
diff --git a/bookwyrm/migrations/0052_auto_20201005_2145.py b/bookwyrm/migrations/0052_auto_20201005_2145.py
new file mode 100644
index 00000000..430c8358
--- /dev/null
+++ b/bookwyrm/migrations/0052_auto_20201005_2145.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.7 on 2020-10-05 21:45
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('bookwyrm', '0051_auto_20201005_2142'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='user',
+ name='email',
+ field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
+ ),
+ ]
diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py
index 0673f53f..0cd8b978 100644
--- a/bookwyrm/models/user.py
+++ b/bookwyrm/models/user.py
@@ -18,7 +18,6 @@ class User(OrderedCollectionPageMixin, AbstractUser):
''' a user who wants to read books '''
private_key = models.TextField(blank=True, null=True)
public_key = models.TextField(blank=True, null=True)
- email = models.EmailField(unique=True)
inbox = models.CharField(max_length=255, unique=True)
shared_inbox = models.CharField(max_length=255, blank=True, null=True)
federated_server = models.ForeignKey(
diff --git a/bookwyrm/templates/edit_user.html b/bookwyrm/templates/edit_user.html
index 1d2db706..a95cbca2 100644
--- a/bookwyrm/templates/edit_user.html
+++ b/bookwyrm/templates/edit_user.html
@@ -29,6 +29,13 @@
{{ error | escape }}
{% endfor %}
+
+
+ {{ form.email }}
+ {% for error in form.email.errors %}
+
{{ error | escape }}
+ {% endfor %}
+