Django

Code

Ticket #2158 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: James Wheare Assigned to: adrian
Milestone: Component: Contrib apps
Version: SVN Keywords: syndication, feeds, templates, urls
Cc: django@sparemint.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

syndication.diff (2.2 kB) - added by James Wheare on 06/15/06 13:23:16.
Added ability to specify title and description templates

Change History

06/14/06 11:16:33 changed by anonymous

  • cc set to django@sparemint.com.

06/15/06 13:23:16 changed by James Wheare

  • attachment syndication.diff added.

Added ability to specify title and description templates

06/15/06 13:24:10 changed by James Wheare

  • severity changed from major to normal.
  • summary changed from Syndication framework doesn't allow custom template paths for description and title per feed url. to [patch] Syndication framework doesn't allow custom template paths..

06/15/06 13:25:04 changed by James Wheare

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

06/17/06 22:14:47 changed by anonymous

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

06/20/06 10:35:19 changed by adrian

  • status changed from new to assigned.

Patch appears to use 8 spaces instead of 4

06/20/06 11:59:58 changed by James Wheare <django@sparemint.com>

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

06/20/06 12:27:34 changed by James Wheare <django@sparemint.com>

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)

06/26/06 18:19:03 changed by adrian

  • status changed from assigned to closed.
  • resolution set to fixed.

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

06/26/06 20:34:11 changed by James Wheare <django@sparemint.com>

Ah yes much cleaner. Thanks :)


Add/Change #2158 ([patch] Syndication framework doesn't allow custom template paths.)




Change Properties
Action