If users' url type patterns are settled, for example,
1. myurl.com/feeds/recnets/
2. myurl.com/feeds/users/
3. myurl.com/feeds/tags/
4. myurl.com/feeds/~
I want to make a dictionary to pass specific function from those patterns.
So I make a dictionary type in urls.py and passing its dictionary parameters. (see below)
1 import os.path
2 from django.conf.urls import patterns, include, url
3 from bookmarks.views import *
4 from django.contrib import admin
5 from django.views.generic import TemplateView
6 from bookmarks.feeds import *
7
8 admin.autodiscover()
9
10 site_media = os.path.join(
11 os.path.dirname(__file__), 'site_media'
12 )
13
14 feeds = {
15 'recents' : RecentBookmarks(),
16 'user' : UserBookmarks()
17 }
18
19 urlpatterns = patterns('',
20 # Feeds
21 (r'^feeds/(?P<url>.*)$',
22 feeds),
As I expected, it did not work because urls.py did not differentiate parameters' name.
I also referred django project document to resolve this problem, but I could not found it how to pass hash arguments to function at url side.