Preserve remote_id syntax for authors and books
This commit is contained in:
@ -1,7 +1,4 @@
|
||||
''' database schema for info about authors '''
|
||||
from uuid import uuid4
|
||||
import re
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
@ -37,18 +34,13 @@ class Author(ActivitypubMixin, BookWyrmModel):
|
||||
self.remote_id = self.get_remote_id()
|
||||
|
||||
if not self.id:
|
||||
# force set the remote id to a local version
|
||||
self.origin_id = self.remote_id
|
||||
self.remote_id = self.get_remote_id()
|
||||
self.remote_id = None
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def get_remote_id(self):
|
||||
''' editions and works both use "book" instead of model_name '''
|
||||
uuid = str(uuid4())[:8]
|
||||
# in Book, the title is used to make the url more readable, but
|
||||
# since an author's name can change, I didn't want to lock in a
|
||||
# potential deadname (or maiden name) in the urk.
|
||||
return 'https://%s/author/%s' % (DOMAIN, uuid)
|
||||
return 'https://%s/author/%s' % (DOMAIN, self.id)
|
||||
|
||||
@property
|
||||
def display_name(self):
|
||||
|
Reference in New Issue
Block a user