Skip to content

Commit

Permalink
fix: handle missing category in OPML export
Browse files Browse the repository at this point in the history
  • Loading branch information
versun committed Jun 24, 2024
1 parent ac50081 commit 9040dfe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/modelAdmin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
class CustomModelActions:
def o_feed_export_as_opml(self, request, queryset):
opml_obj = OPML()

for item in queryset:
category_outline = Outline(text=item.category.name)
category = item.category.name if item.category else 'default'
category_outline = Outline(text=category)
item_outline = Outline(
title=item.name,
text=item.name,
Expand All @@ -49,12 +50,13 @@ def t_feed_export_as_opml(self, request, queryset):
opml_obj = OPML()

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

category_outline = Outline(text=item.o_feed.category.name)
category_outline = Outline(text=category)
item_outline = Outline(
title=text,
text=text,
Expand Down

0 comments on commit 9040dfe

Please sign in to comment.