Merge pull request #76 from cthulahoops/user_profile_form

Fix user profile page & rebuilddb.
This commit is contained in:
Mouse Reeve 2020-03-08 13:55:04 -07:00 committed by GitHub
commit a0f1880f37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 9 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 3.0.3 on 2020-03-08 16:25
from django.db import migrations, models
import fedireads.utils.fields
class Migration(migrations.Migration):
dependencies = [
('fedireads', '0011_notification'),
]
operations = [
migrations.AlterField(
model_name='author',
name='aliases',
field=fedireads.utils.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, default=list, size=None),
),
]

View file

@ -79,6 +79,6 @@ class Author(FedireadsModel):
name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255, null=True)
first_name = models.CharField(max_length=255, null=True)
aliases = ArrayField(models.CharField(max_length=255), blank=True)
aliases = ArrayField(models.CharField(max_length=255), blank=True, default=list)
bio = models.TextField(null=True, blank=True)

View file

@ -16,7 +16,7 @@
{% if is_self %}
<div class="interaction">
<a href="/user/edit">Edit profile</a>
<a href="/edit_profile_page/">Edit profile</a>
</div>
{% endif %}
</div>

View file

@ -41,8 +41,7 @@ urlpatterns = [
re_path(r'^logout/?$', views.user_logout),
re_path(r'^notifications/?', views.notifications_page),
re_path(r'%s/?$' % user_path, views.user_page),
re_path(r'%s/edit/?$' % user_path, views.edit_profile_page),
re_path(r'^user/edit/?$', views.edit_profile_page),
re_path(r'edit_profile_page/?$', views.edit_profile_page),
re_path(r'%s/?$' % status_path, views.status_page),
re_path(r'^book/(?P<book_identifier>\w+)/?$', views.book_page),
re_path(r'^book/(?P<book_identifier>\w+)/(?P<tab>friends|local|federated)?$', views.book_page),

View file

@ -204,12 +204,9 @@ def status_page(request, username, status_id):
@login_required
def edit_profile_page(request, username):
def edit_profile_page(request):
''' profile page for a user '''
try:
user = models.User.objects.get(localname=username)
except models.User.DoesNotExist:
return HttpResponseNotFound()
user = request.user
form = forms.EditUserForm(instance=request.user)
data = {