Skip to content

Commit 9040dfe

Browse files
committed
fix: handle missing category in OPML export
1 parent ac50081 commit 9040dfe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

utils/modelAdmin_utils.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
class CustomModelActions:
2525
def o_feed_export_as_opml(self, request, queryset):
2626
opml_obj = OPML()
27-
27+
2828
for item in queryset:
29-
category_outline = Outline(text=item.category.name)
29+
category = item.category.name if item.category else 'default'
30+
category_outline = Outline(text=category)
3031
item_outline = Outline(
3132
title=item.name,
3233
text=item.name,
@@ -49,12 +50,13 @@ def t_feed_export_as_opml(self, request, queryset):
4950
opml_obj = OPML()
5051

5152
for item in queryset:
53+
category = item.o_feed.category.name if item.o_feed.category else 'default'
5254
text = item.o_feed.name or "No Name"
5355
xml_url = request.build_absolute_uri(
5456
reverse("core:rss", kwargs={"feed_sid": item.sid})
5557
)
5658

57-
category_outline = Outline(text=item.o_feed.category.name)
59+
category_outline = Outline(text=category)
5860
item_outline = Outline(
5961
title=text,
6062
text=text,

0 commit comments

Comments
 (0)