Private
Public Access
Subscription editing was a real gap: there was no way to rename a feed's display title, move it between folders, or create a folder at all outside OPML import. Added an edit page (apps/feeds/views.py:edit_subscription, EditSubscriptionForm) reachable from the subscriptions list. Added feed-level tagging via a new SubscriptionTag model (apps/articles/ models.py), mirroring the existing ArticleTag — tag a whole feed on its edit page, and every one of its articles surfaces under that tag in the stream alongside individually-tagged articles (apps.reader.views._apply_ scope now matches either). Renamed AddTagToArticleForm to AddTagForm since it's shared by both now. The stream also now remembers the last filter (unread/all/starred/saved) in the session instead of always defaulting to "unread" when a sidebar feed/folder/tag link omits ?filter= — sidebar links no longer force ?filter=all, letting the remembered choice apply. Verified end to end against a running dev server: editing a subscription's title/folder, creating a folder inline, tagging a feed and seeing its articles appear under that tag, and the remembered-filter behavior across requests with no ?filter= param. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
from django import forms
|
|
|
|
from .models import Folder, Subscription
|
|
|
|
|
|
class AddFeedForm(forms.Form):
|
|
feed_url = forms.URLField(label="Feed URL", max_length=1000, assume_scheme="https")
|
|
folder = forms.ModelChoiceField(queryset=Folder.objects.none(), required=False)
|
|
|
|
def __init__(self, *args, user=None, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
if user is not None:
|
|
self.fields["folder"].queryset = Folder.objects.filter(user=user)
|
|
|
|
|
|
class EditSubscriptionForm(forms.ModelForm):
|
|
new_folder_name = forms.CharField(
|
|
label="Or create a new folder",
|
|
max_length=255,
|
|
required=False,
|
|
help_text="Leave blank to use the folder selected above.",
|
|
)
|
|
|
|
class Meta:
|
|
model = Subscription
|
|
fields = ["custom_title", "folder"]
|
|
labels = {"custom_title": "Title (leave blank to use the feed's own title)"}
|
|
|
|
def __init__(self, *args, user=None, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self._user = user
|
|
self.fields["folder"].queryset = Folder.objects.filter(user=user)
|
|
self.fields["folder"].required = False
|
|
|
|
def save(self, commit=True):
|
|
subscription = super().save(commit=False)
|
|
new_folder_name = self.cleaned_data.get("new_folder_name", "").strip()
|
|
if new_folder_name:
|
|
folder, _created = Folder.objects.get_or_create(user=self._user, name=new_folder_name)
|
|
subscription.folder = folder
|
|
if commit:
|
|
subscription.save()
|
|
return subscription
|
|
|
|
|
|
class OPMLImportForm(forms.Form):
|
|
opml_file = forms.FileField(label="OPML file")
|