Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2158 closed enhancement (fixed)

[patch] Syndication framework doesn't allow custom template paths.

Reported by: James Wheare Owned by: Adrian Holovaty
Component: Contrib apps Version: dev
Severity: normal Keywords: syndication, feeds, templates, urls
Cc: django@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Let me illustrate this with an example.

I have two sorts of feeds in my app:

/authors/feed/ # simple feed of all authors
/authors/authorname/feed/ # complex per-author feed

Defined by the following URLconf

feeds = {
	'authors': AuthorsFeed,
}
author_feed = {
	'authors': AuthorFeed,
}
(r'^(?P<url>authors/[-\w]+)/feed/$', 'feed', {'feed_dict': author_feed}),
(r'^(?P<url>authors)/feed/$', 'feed', {'feed_dict': feeds}),

The problem is that both urls share the same slug "authors" which determines the feed model to use and—more critically—the template paths (authors_description, authors_title)

I managed to work around the model issue by specifying two different feed_dicts but I can't see a way to specify different templates for each feed without patching django.contrib.syndication.views.

Attachments (1)

syndication.diff (2.2 KB ) - added by James Wheare 18 years ago.
Added ability to specify title and description templates

Download all attachments as: .zip

Change History (10)

comment:1 by anonymous, 18 years ago

Cc: django@… added

by James Wheare, 18 years ago

Attachment: syndication.diff added

Added ability to specify title and description templates

comment:2 by James Wheare, 18 years ago

Severity: majornormal
Summary: Syndication framework doesn't allow custom template paths for description and title per feed url.[patch] Syndication framework doesn't allow custom template paths.

comment:3 by James Wheare, 18 years ago

I'm sure this patch is a really hackish way of doing this and the variable names are awful but at least it works.

comment:4 by anonymous, 18 years ago

Ack! Ignore "comments_extras.diff". I accidentally attached that to the wrong ticket. My apologies.

comment:5 by Adrian Holovaty, 18 years ago

Status: newassigned

Patch appears to use 8 spaces instead of 4

comment:6 by James Wheare <django@…>, 18 years ago

Yeah, can't figure out how to reduce spaces-per-tab in TextMate.

comment:7 by James Wheare <django@…>, 18 years ago

Actually, it *is* using 4 spaces, trac seems to be screwing the formatting it up, check the raw format. (And yes, I figured out the textmate issue, stupid me)

comment:8 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: assignedclosed

(In [3214]) Fixed #2158 -- Added title_template and description_template hooks to Feed class in syndication framework.

comment:9 by James Wheare <django@…>, 18 years ago

Ah yes much cleaner. Thanks :)

Note: See TracTickets for help on using tickets.
Back to Top