Private
Public Access
Add subscription editing, feed-level tags, and a remembered stream filter
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>
This commit is contained in:
1 parent
cfa64b5485
commit
3b58fdcb7e
15 files changed
+376
-23
No files matched your search
@@ -10,9 +10,10 @@ class TagForm(forms.ModelForm):
|
||||
widgets = {"color": forms.TextInput(attrs={"type": "color"})}
|
||||
|
||||
|
||||
class AddTagToArticleForm(forms.Form):
|
||||
"""Freeform tag-name entry — assigning an unknown name creates that tag
|
||||
for the user, so there's one flow instead of "create tag" then
|
||||
"assign tag" as two separate steps."""
|
||||
class AddTagForm(forms.Form):
|
||||
"""Freeform tag-name entry, used for tagging both articles and
|
||||
subscriptions — assigning an unknown name creates that tag for the
|
||||
user, so there's one flow instead of "create tag" then "assign tag" as
|
||||
two separate steps."""
|
||||
|
||||
tag_name = forms.CharField(max_length=100)
|
||||
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.2.18 on 2026-10-31 03:17
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('articles', '0001_initial'),
|
||||
('feeds', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='SubscriptionTag',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('subscription', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscription_tags', to='feeds.subscription')),
|
||||
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscription_tags', to='articles.tag')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'unique_together': {('user', 'subscription', 'tag')},
|
||||
},
|
||||
),
|
||||
]
|
||||
+22
-1
@@ -1,7 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
from apps.feeds.models import Feed
|
||||
from apps.feeds.models import Feed, Subscription
|
||||
|
||||
|
||||
class Article(models.Model):
|
||||
@@ -89,3 +89,24 @@ class ArticleTag(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.article} -> {self.tag}"
|
||||
|
||||
|
||||
class SubscriptionTag(models.Model):
|
||||
"""Tags a feed itself (via the user's Subscription to it), independent
|
||||
of tagging individual articles — e.g. tagging a whole feed "backend"
|
||||
rather than tagging each of its articles one by one. Articles from a
|
||||
tagged feed show up under that tag in the stream alongside any
|
||||
individually-tagged articles (see apps.reader.views._apply_scope).
|
||||
"""
|
||||
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
subscription = models.ForeignKey(
|
||||
Subscription, on_delete=models.CASCADE, related_name="subscription_tags"
|
||||
)
|
||||
tag = models.ForeignKey(Tag, on_delete=models.CASCADE, related_name="subscription_tags")
|
||||
|
||||
class Meta:
|
||||
unique_together = [("user", "subscription", "tag")]
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.subscription} -> {self.tag}"
|
||||
@@ -3,7 +3,7 @@ from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from .forms import AddTagToArticleForm, TagForm
|
||||
from .forms import AddTagForm, TagForm
|
||||
from .models import Article, ArticleTag, Tag
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ def article_tags_partial(request, article_id):
|
||||
@require_POST
|
||||
def add_tag_to_article(request, article_id):
|
||||
article = _owned_article(request.user, article_id)
|
||||
form = AddTagToArticleForm(request.POST)
|
||||
form = AddTagForm(request.POST)
|
||||
if form.is_valid():
|
||||
tag_name = form.cleaned_data["tag_name"].strip()
|
||||
if tag_name:
|
||||
|
||||
Reference in new issue
Block a user