from django.conf.urls.defaults import *
from blogserver.apps.blog.models import Post
from blogserver.apps.blog import feeds

index_dict = {
    'queryset': Post.live.order_by('-date_published'),
    'template_object_name': 'post',
}

display_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_detail.html',
    'extra_context': { 'post_display' : True },
     'month_format':'%m',
}

day_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
     'month_format':'%m',
}

month_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
     'month_format':'%m',
}

year_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
    'make_object_list': True
}

feeds = {
    'latest': feeds.LatestPosts,
    'category': feeds.Categories,
}

urlpatterns = patterns ('django.views.generic.list_detail',
    # Post List
    url(r'^$', 'object_list', index_dict, 'blog_post_archive_list'),
)
urlpatterns += patterns('django.views.generic.date_based',
    # Display Post
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/(?P<day>(\d){2})/(?P<slug>[-\w]+)/$', 'object_detail', display_dict, name="post_detail"),

    # Daiely Archive
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/(?P<day>(\d){2})/$', 'archive_day', day_dict, name="post_day" ),
    # Monthly Archive
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/$', 'archive_month', month_dict, name="post_month" ),
    
    # Yearly Archive
    (r'^(?P<year>(\d){4})/$', 'archive_year', year_dict, "post_year" ),
    
)

urlpatterns += patterns('',
    url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'),
)


from django.conf.urls.defaults import *
from blogserver.apps.blog.models import Post
from blogserver.apps.blog import feeds

index_dict = {
    'queryset': Post.live.order_by('-date_published'),
    'template_object_name': 'post',
}

display_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_detail.html',
    'extra_context': { 'post_display' : True },
     'month_format':'%m',
}

day_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
     'month_format':'%m',
}

month_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
     'month_format':'%m',
}

year_dict = {
    'queryset': Post.live.all(),
    'date_field': 'date_published',
    'template_name': 'blog/post_list.html',
    'template_object_name':'post',
    'make_object_list': True
}

feeds = {
    'latest': feeds.LatestPosts,
    'category': feeds.Categories,
}

urlpatterns = patterns ('django.views.generic.list_detail',
    # Post List
    url(r'^$', 'object_list', index_dict, 'blog_post_archive_list'),
)
urlpatterns += patterns('django.views.generic.date_based',
    # Display Post
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/(?P<day>(\d){2})/(?P<slug>[-\w]+)/$', 'object_detail', display_dict, name="post_detail"),

    # Daiely Archive
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/(?P<day>(\d){2})/$', 'archive_day', day_dict, name="post_day" ),
    # Monthly Archive
    url(r'^(?P<year>(\d){4})/(?P<month>(\d){2})/$', 'archive_month', month_dict, name="post_month" ),
    
    # Yearly Archive
    (r'^(?P<year>(\d){4})/$', 'archive_year', year_dict, "post_year" ),
    
)

urlpatterns += patterns('',
    url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'),
)


# Post List # Display Post # Daiely Archive # Monthly Archive # Yearly Archive