forked from mirrors/bookwyrm
user's name and bio field are optional
get it together, mouse
This commit is contained in:
parent
7f1ac33859
commit
60738011a2
4 changed files with 32 additions and 6 deletions
|
@ -18,13 +18,13 @@ class PublicKey(ActivityObject):
|
|||
class Person(ActivityObject):
|
||||
''' actor activitypub json '''
|
||||
preferredUsername: str
|
||||
name: str
|
||||
inbox: str
|
||||
outbox: str
|
||||
followers: str
|
||||
summary: str
|
||||
publicKey: PublicKey
|
||||
endpoints: Dict
|
||||
name: str = None
|
||||
summary: str = None
|
||||
icon: Image = field(default_factory=lambda: {})
|
||||
bookwyrmUser: bool = False
|
||||
manuallyApprovesFollowers: str = False
|
||||
|
|
24
bookwyrm/migrations/0027_auto_20201220_2007.py
Normal file
24
bookwyrm/migrations/0027_auto_20201220_2007.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Generated by Django 3.0.7 on 2020-12-20 20:07
|
||||
|
||||
import bookwyrm.models.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0026_status_content_warning'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='name',
|
||||
field=bookwyrm.models.fields.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='summary',
|
||||
field=bookwyrm.models.fields.HtmlField(blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -42,7 +42,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
blank=True,
|
||||
)
|
||||
outbox = fields.RemoteIdField(unique=True)
|
||||
summary = fields.HtmlField(default='')
|
||||
summary = fields.HtmlField(null=True, blank=True)
|
||||
local = models.BooleanField(default=False)
|
||||
bookwyrm_user = fields.BooleanField(default=True)
|
||||
localname = models.CharField(
|
||||
|
@ -51,7 +51,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
unique=True
|
||||
)
|
||||
# name is your display name, which you can change at will
|
||||
name = fields.CharField(max_length=100, default='')
|
||||
name = fields.CharField(max_length=100, null=True, blank=True)
|
||||
avatar = fields.ImageField(
|
||||
upload_to='avatars/', blank=True, null=True,
|
||||
activitypub_field='icon', alt_field='alt_text')
|
||||
|
|
|
@ -208,7 +208,7 @@ def edit_profile(request):
|
|||
ContentFile(output.getvalue())
|
||||
)
|
||||
|
||||
request.user.summary = form.data['summary']
|
||||
request.user.summary = outgoing.to_markdown(form.data['summary'])
|
||||
request.user.manually_approves_followers = \
|
||||
form.cleaned_data['manually_approves_followers']
|
||||
request.user.save()
|
||||
|
@ -244,7 +244,9 @@ def edit_book(request, book_id):
|
|||
'form': form
|
||||
}
|
||||
return TemplateResponse(request, 'edit_book.html', data)
|
||||
form.save()
|
||||
book = form.save(commit=False)
|
||||
book.description = outgoing.to_markown(book.description)
|
||||
book.save()
|
||||
|
||||
outgoing.handle_update_book(request.user, book)
|
||||
return redirect('/book/%s' % book.id)
|
||||
|
|
Loading…
Reference in a new issue