-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
executable file
·105 lines (85 loc) · 3.92 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import direct_to_template
from django.contrib import admin
from account.openid_consumer import PinaxConsumer
import os.path
from microblogging.feeds import TweetFeedAll, TweetFeedUser, TweetFeedUserWithFriends
tweets_feed_dict = {"feed_dict": {
'all': TweetFeedAll,
'only': TweetFeedUser,
'with_friends': TweetFeedUserWithFriends,
}}
from blog.feeds import BlogFeedAll, BlogFeedUser
blogs_feed_dict = {"feed_dict": {
'all': BlogFeedAll,
'only': BlogFeedUser,
}}
from bookmarks.feeds import BookmarkFeed
bookmarks_feed_dict = {"feed_dict": { '': BookmarkFeed }}
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', direct_to_template, {"template": "homepage.html"}, name="home"),
(r'^about/', include('about.urls')),
(r'^account/', include('account.urls')),
(r'^openid/(.*)', PinaxConsumer()),
(r'^bbauth/', include('bbauth.urls')),
(r'^authsub/', include('authsub.urls')),
(r'^profiles/', include('profiles.urls')),
(r'^blog/', include('blog.urls')),
(r'^tags/', include('tag_app.urls')),
(r'^invitations/', include('friends_app.urls')),
(r'^notices/', include('notification.urls')),
(r'^messages/', include('messages.urls')),
(r'^announcements/', include('announcements.urls')),
(r'^tweets/', include('microblogging.urls')),
(r'^tribes/', include('tribes.urls')),
(r'^projects/', include('projects.urls')),
(r'^comments/', include('threadedcomments.urls')),
(r'^robots.txt$', include('robots.urls')),
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^bookmarks/', include('bookmarks.urls')),
(r'^admin/(.*)', admin.site.root),
(r'^photos/', include('photos.urls')),
(r'^avatar/', include('avatar.urls')),
(r'^swaps/', include('swaps.urls')),
(r'^flag/', include('flag.urls')),
(r'^locations/', include('locations.urls')),
(r'^feeds/tweets/(.*)/$', 'django.contrib.syndication.views.feed', tweets_feed_dict),
(r'^feeds/posts/(.*)/$', 'django.contrib.syndication.views.feed', blogs_feed_dict),
(r'^feeds/bookmarks/(.*)/?$', 'django.contrib.syndication.views.feed', bookmarks_feed_dict),
)
## @@@ for now, we'll use friends_app to glue this stuff together
from photos.models import Image
friends_photos_kwargs = {
"template_name": "photos/friends_photos.html",
"friends_objects_function": lambda users: Image.objects.filter(member__in=users),
}
from blog.models import Post
friends_blogs_kwargs = {
"template_name": "blog/friends_posts.html",
"friends_objects_function": lambda users: Post.objects.filter(author__in=users),
}
from microblogging.models import Tweet
friends_tweets_kwargs = {
"template_name": "microblogging/friends_tweets.html",
"friends_objects_function": lambda users: Tweet.objects.filter(sender_id__in=[user.id for user in users], sender_type__name='user'),
}
from bookmarks.models import Bookmark
friends_bookmarks_kwargs = {
"template_name": "bookmarks/friends_bookmarks.html",
"friends_objects_function": lambda users: Bookmark.objects.filter(saved_instances__user__in=users),
"extra_context": {
"user_bookmarks": lambda request: Bookmark.objects.filter(saved_instances__user=request.user),
},
}
urlpatterns += patterns('',
url('^photos/friends_photos/$', 'friends_app.views.friends_objects', kwargs=friends_photos_kwargs, name="friends_photos"),
url('^blog/friends_blogs/$', 'friends_app.views.friends_objects', kwargs=friends_blogs_kwargs, name="friends_blogs"),
url('^tweets/friends_tweets/$', 'friends_app.views.friends_objects', kwargs=friends_tweets_kwargs, name="friends_tweets"),
url('^bookmarks/friends_bookmarks/$', 'friends_app.views.friends_objects', kwargs=friends_bookmarks_kwargs, name="friends_bookmarks"),
)
if settings.SERVE_MEDIA:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'staticfiles.views.serve')
)