# Path: dwitter/feed/views.py
# class HotDweetFeed(AllDweetFeed):
#     title = "Dwitter  - javascript demos in 140 characters"
#     sort = SortMethod.HOT
#     feed_name = "hot"
# 
# class NewDweetFeed(AllDweetFeed):
#     title = "New dweets | Dwitter"
#     sort = SortMethod.NEW
#     feed_name = "new"
# 
# class RandomDweetFeed(AllDweetFeed):
#     title = "Random dweets | Dwitter"
#     sort = SortMethod.RANDOM
#     feed_name = "random"
# 
# Path: dwitter/feed/views.py
# class TopWeekDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this week | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-week"
#     top_name = "week"
#     days = 7
# 
# class TopMonthDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this month | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-month"
#     top_name = "month"
#     days = 30
# 
# class TopYearDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this year | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-year"
#     top_name = "year"
#     days = 365
# 
# class TopAllDweetFeed(AllDweetFeed):
#     title = "Top dweets of all time | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-all"
#     top_name = "all time"
# 
#     def get_context_data(self, **kwargs):
#         context = super(TopAllDweetFeed, self).get_context_data(**kwargs)
#         context['top_name'] = self.top_name
#         return context
# 
#     def get_dweet_list(self):
#         return Dweet.objects.annotate(num_likes=Count('likes'))
# 
# Path: dwitter/feed/views.py
# class NewHashtagFeed(HashtagFeed):
#     sort = SortMethod.NEW
#     feed_name = "new"
# 
#     def get_title(self):
#         hashtag_name = self.kwargs['hashtag_name']
#         return "New #" + hashtag_name + " dweets | Dwitter"
# 
# class TopHashtagFeed(HashtagFeed):
#     sort = SortMethod.TOP
#     feed_name = "top"
# 
#     def get_title(self):
#         hashtag_name = self.kwargs['hashtag_name']
#         return "Top #" + hashtag_name + " dweets | Dwitter"
# 
#     def get_dweet_list(self):
#         return super().get_dweet_list().annotate(num_likes=Count('likes'))


from django.conf.urls import url
from . import views
from .views import HotDweetFeed, NewDweetFeed, RandomDweetFeed
from .views import TopWeekDweetFeed, TopMonthDweetFeed, TopYearDweetFeed, TopAllDweetFeed
from .views import NewHashtagFeed, TopHashtagFeed

urlpatterns = [
    url(r'^test/', HotDweetFeed.as_view()),

    url(r'^$', HotDweetFeed.as_view(), name='root'),
    url(r'^hot$', HotDweetFeed.as_view(), name='hot_feed'),

    # Default top to top of the month
    url(r'^top$', TopMonthDweetFeed.as_view(), name='top_feed'),
    url(r'^top/week$', TopWeekDweetFeed.as_view(), name='top_feed_week'),
    url(r'^top/month$', TopMonthDweetFeed.as_view(), name='top_feed_month'),
    url(r'^top/year$', TopYearDweetFeed.as_view(), name='top_feed_year'),
    url(r'^top/all$', TopAllDweetFeed.as_view(), name='top_feed_all'),

    url(r'^new$', NewDweetFeed.as_view(), name='new_feed'),
    url(r'^random$', RandomDweetFeed.as_view(), name='random_feed'),

    url(r'^h/(?P<hashtag_name>[\w._]+)$', NewHashtagFeed.as_view(), name='hashtag_feed'),

# Path: dwitter/feed/views.py
# class HotDweetFeed(AllDweetFeed):
#     title = "Dwitter  - javascript demos in 140 characters"
#     sort = SortMethod.HOT
#     feed_name = "hot"
# 
# class NewDweetFeed(AllDweetFeed):
#     title = "New dweets | Dwitter"
#     sort = SortMethod.NEW
#     feed_name = "new"
# 
# class RandomDweetFeed(AllDweetFeed):
#     title = "Random dweets | Dwitter"
#     sort = SortMethod.RANDOM
#     feed_name = "random"
# 
# Path: dwitter/feed/views.py
# class TopWeekDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this week | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-week"
#     top_name = "week"
#     days = 7
# 
# class TopMonthDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this month | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-month"
#     top_name = "month"
#     days = 30
# 
# class TopYearDweetFeed(TopDweetFeedBase):
#     title = "Top dweets this year | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-year"
#     top_name = "year"
#     days = 365
# 
# class TopAllDweetFeed(AllDweetFeed):
#     title = "Top dweets of all time | Dwitter"
#     sort = SortMethod.TOP
#     feed_name = "top-all"
#     top_name = "all time"
# 
#     def get_context_data(self, **kwargs):
#         context = super(TopAllDweetFeed, self).get_context_data(**kwargs)
#         context['top_name'] = self.top_name
#         return context
# 
#     def get_dweet_list(self):
#         return Dweet.objects.annotate(num_likes=Count('likes'))
# 
# Path: dwitter/feed/views.py
# class NewHashtagFeed(HashtagFeed):
#     sort = SortMethod.NEW
#     feed_name = "new"
# 
#     def get_title(self):
#         hashtag_name = self.kwargs['hashtag_name']
#         return "New #" + hashtag_name + " dweets | Dwitter"
# 
# class TopHashtagFeed(HashtagFeed):
#     sort = SortMethod.TOP
#     feed_name = "top"
# 
#     def get_title(self):
#         hashtag_name = self.kwargs['hashtag_name']
#         return "Top #" + hashtag_name + " dweets | Dwitter"
# 
#     def get_dweet_list(self):
#         return super().get_dweet_list().annotate(num_likes=Count('likes'))


# Path: dwitter/feed/urls.py
from django.conf.urls import url
from . import views
from .views import HotDweetFeed, NewDweetFeed, RandomDweetFeed
from .views import TopWeekDweetFeed, TopMonthDweetFeed, TopYearDweetFeed, TopAllDweetFeed
from .views import NewHashtagFeed, TopHashtagFeed


urlpatterns = [
    url(r'^test/', HotDweetFeed.as_view()),

    url(r'^$', HotDweetFeed.as_view(), name='root'),
    url(r'^hot$', HotDweetFeed.as_view(), name='hot_feed'),

    # Default top to top of the month
    url(r'^top$', TopMonthDweetFeed.as_view(), name='top_feed'),
    url(r'^top/week$', TopWeekDweetFeed.as_view(), name='top_feed_week'),
    url(r'^top/month$', TopMonthDweetFeed.as_view(), name='top_feed_month'),
    url(r'^top/year$', TopYearDweetFeed.as_view(), name='top_feed_year'),
    url(r'^top/all$', TopAllDweetFeed.as_view(), name='top_feed_all'),

    url(r'^new$', NewDweetFeed.as_view(), name='new_feed'),
    url(r'^random$', RandomDweetFeed.as_view(), name='random_feed'),

    url(r'^h/(?P<hashtag_name>[\w._]+)$', NewHashtagFeed.as_view(), name='hashtag_feed'),

    url(r'^h/(?P<hashtag_name>[\w._]+)/top$', TopHashtagFeed.as_view(), name='top_hashtag_feed'),