automatically load authors and editions

This commit is contained in:
Mouse Reeve
2020-11-28 13:00:04 -08:00
parent e99394e6f7
commit 421a13fda0
3 changed files with 20 additions and 25 deletions

View File

@ -124,7 +124,7 @@ class ActivityObject:
formatted_value = timezone.make_aware(date_value)
except ValueError:
formatted_value = date_value
except ParserError:
except (ParserError, TypeError):
formatted_value = None
elif isinstance(model_field, ForwardManyToOneDescriptor) and \
formatted_value:
@ -182,12 +182,17 @@ class ActivityObject:
model = model_field.model
items = []
for link in values:
# check that the Type matches the model (because Status
# tags contain both user mentions and book tags)
if not model.activity_serializer.type == link.get('type'):
continue
if isinstance(link, dict):
# check that the Type matches the model (Status
# tags contain both user mentions and book tags)
if not model.activity_serializer.type == \
link.get('type'):
continue
remote_id = link.get('href')
else:
remote_id = link
items.append(
resolve_remote_id(model, link.get('href'))
resolve_remote_id(model, remote_id)
)
getattr(instance, model_key).set(items)