Unify concept of absolute_id and remote_id

This commit is contained in:
Mouse Reeve
2020-05-12 18:56:28 -07:00
parent 93493fc8e4
commit e76f96eb6c
33 changed files with 263 additions and 236 deletions

View File

@ -1,7 +1,6 @@
''' puttin' books on shelves '''
from django.db import models
from fedireads import activitypub
from .base_model import FedireadsModel
@ -17,12 +16,10 @@ class Shelf(FedireadsModel):
through_fields=('shelf', 'book')
)
@property
def absolute_id(self):
''' use shelf identifier as absolute id '''
base_path = self.user.absolute_id
model_name = type(self).__name__.lower()
return '%s/%s/%s' % (base_path, model_name, self.identifier)
def get_remote_id(self):
''' shelf identifier instead of id '''
base_path = self.user.remote_id
return '%s/shelf/%s' % (base_path, self.identifier)
class Meta:
unique_together = ('user', 'identifier')