Skip to content
Snippets Groups Projects

Resolve "'NoneType' object has no attribute '_meta'"

Merged Ghost User requested to merge 103-no_meta into master
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
+ 8
3
@@ -59,7 +59,7 @@ class LDListMixin:
@@ -59,7 +59,7 @@ class LDListMixin:
try:
try:
list = next(
list = next(
filter(lambda o: list[self.parent.url_field_name] == o[self.parent.url_field_name], object_list))
filter(lambda o: list[self.parent.url_field_name] == o[self.parent.url_field_name], object_list))
except (KeyError, TypeError):
except (KeyError, TypeError, StopIteration):
pass
pass
try:
try:
@@ -350,8 +350,13 @@ class LDPSerializer(HyperlinkedModelSerializer):
@@ -350,8 +350,13 @@ class LDPSerializer(HyperlinkedModelSerializer):
def get_value(self, dictionary):
def get_value(self, dictionary):
try:
try:
object_list = dictionary["@graph"]
object_list = dictionary["@graph"]
container_id = Model.container_id(self.parent.instance)
if self.parent.instance is None:
obj = next(filter(lambda o: container_id in o[self.url_field_name], object_list))
obj = next(filter(
 
lambda o: not hasattr(o, self.parent.url_field_name) or "./" in o[self.url_field_name],
 
object_list))
 
else:
 
container_id = Model.container_id(self.parent.instance)
 
obj = next(filter(lambda o: container_id in o[self.url_field_name], object_list))
item = super().get_value(obj)
item = super().get_value(obj)
full_item = None
full_item = None
if item is empty:
if item is empty:
Loading