public
Description: A Django Based Blog
Homepage: http://altmansoftware.lighthouseapp.com/projects/19962-shiftingbits
Clone URL: git://github.com/paltman/shiftingbits.git
100644 71 lines (49 sloc) 2.884 kb
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
from django.conf.urls.defaults import *
from shiftingbits.settings import MEDIA_ROOT
from django.contrib import admin
from django.views.generic.simple import direct_to_template
 
from shiftingbits.blog.models import Post
from shiftingbits.blog.views import object_detail, archive_index, archive_month, archive_day, archive_year, object_detail_redirect, archive_day_redirect, archive_month_redirect
from shiftingbits.blog.feeds import LatestPostFeed, LatestPostsByTagFeed
 
 
admin.autodiscover()
 
import mobileadmin
mobileadmin.autoregister()
 
 
feeds = {
    "latest": LatestPostFeed,
    "tags": LatestPostsByTagFeed,
}
 
date_based_dict = {
    "date_field": "pub_date"
}
 
urlpatterns = patterns("",
    ### Feeds
    url(r"^rss.aspx", "shiftingbits.blog.views.feed_redirect"),
    url(r"^feeds/(?P<url>.*)/$", "django.contrib.syndication.views.feed", {"feed_dict": feeds}, name="blog_feeds"),
    
    ### Tags
    url(r"tags/(?P<tag>[^/]+)/$", "tagging.views.tagged_object_list", { "queryset_or_model": Post, "template_object_name":"post", "template_name": "blog/post_archive.html", "related_tags": True}, name="blog_tag_detail"),
    
    ### Handle the way the old links were via redirect
    url(r"^(?P<year>\d{4})/(?P<month>[0-9]*)/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$", object_detail_redirect),
    url(r"^(?P<year>\d{4})/(?P<month>[0-9]*)/(?P<day>\w{1,2})/$", archive_day_redirect),
    url(r"^(?P<year>\d{4})/(?P<month>[0-9]*)/$", archive_month_redirect),
    
    ### Date Based Generic Views for Blog Posts
    url(r"^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$", object_detail, dict(date_based_dict, **{"template_object_name": "post"}), name="blog_post_detail"),
    url(r"^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$", archive_day, dict(date_based_dict, **{"allow_empty": True}), name="blog_archive_daily"),
    url(r"^(?P<year>\d{4})/(?P<month>[a-z]{3})/$", archive_month, dict(date_based_dict, **{"allow_empty":True}), name="blog_archive_month"),
    url(r"^(?P<year>\d{4})/$", archive_year, dict(date_based_dict, **{"allow_empty":True}), name="blog_archive_year"),
    url(r'^$', archive_index, dict(date_based_dict, **{'template_object_name':'post_list'}), name="blog_archive"),
 
    ### Comments
    (r'^comments/', include('django.contrib.comments.urls')),
    
    ### Admin
    (r'^admin/(.*)', admin.site.root),
    
    ### Projects
    (r'^projects/$', direct_to_template, {'template':'projects.html'}),
    
    ### Media
    (r'^media/(?P<path>.*)$' , 'django.views.static.serve', {'document_root': MEDIA_ROOT, 'show_indexes': True })
)
 
from shiftingbits.blog.xmlrpc.urls import urlpatterns as xmlrpcpatterns
 
urlpatterns += xmlrpcpatterns
 
 
urlpatterns += patterns('',
    (r'^ma/(.*)', mobileadmin.sites.site.root),
)
 
handler404 = 'mobileadmin.views.page_not_found'
handler500 = 'mobileadmin.views.server_error'