# Path: organizer/feeds.py
# class AtomStartupFeed(BaseStartupFeedMixin, Feed):
#     feed_type = Atom1Feed
# 
# class Rss2StartupFeed(BaseStartupFeedMixin, Feed):
#     feed_type = Rss201rev2Feed
# 
# Path: organizer/views.py
# class NewsLinkCreate(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         CreateView):
#     form_class = NewsLinkForm
#     model = NewsLink
# 
#     def get_initial(self):
#         startup_slug = self.kwargs.get(
#             self.startup_slug_url_kwarg)
#         self.startup = get_object_or_404(
#             Startup, slug__iexact=startup_slug)
#         initial = {
#             self.startup_context_object_name:
#                 self.startup,
#         }
#         initial.update(self.initial)
#         return initial
# 
# class NewsLinkDelete(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         DeleteView):
#     model = NewsLink
#     slug_url_kwarg = 'newslink_slug'
# 
#     def get_success_url(self):
#         return (self.object.startup
#                 .get_absolute_url())
# 
# class NewsLinkUpdate(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         UpdateView):
#     form_class = NewsLinkForm
#     model = NewsLink
#     slug_url_kwarg = 'newslink_slug'
# 
# class StartupCreate(CreateView):
#     form_class = StartupForm
#     model = Startup
# 
# class StartupDelete(DeleteView):
#     model = Startup
#     success_url = reverse_lazy(
#         'organizer_startup_list')
# 
# class StartupDetail(DetailView):
#     queryset = (
#         Startup.objects.all()
#         .prefetch_related('tags')
#         .prefetch_related('newslink_set')
#         # below omitted because of with tag
#         # and conditional display based on time
#         # .prefetch_related('blog_posts')
#     )
# 
# class StartupList(PageLinksMixin, ListView):
#     model = Startup
#     paginate_by = 5  # 5 items per page
# 
# class StartupUpdate(UpdateView):
#     form_class = StartupForm
#     model = Startup


from django.conf.urls import url
from ..feeds import (
    AtomStartupFeed, Rss2StartupFeed)
from ..views import (
    NewsLinkCreate, NewsLinkDelete,
    NewsLinkUpdate, StartupCreate, StartupDelete,
    StartupDetail, StartupList, StartupUpdate)

urlpatterns = [
    url(r'^$',
        StartupList.as_view(),
        name='organizer_startup_list'),
    url(r'^create/$',
        StartupCreate.as_view(),
        name='organizer_startup_create'),
    url(r'^(?P<slug>[\w\-]+)/$',
        StartupDetail.as_view(),
        name='organizer_startup_detail'),
    url(r'^(?P<startup_slug>[\w\-]+)/'
        r'add_article_link/$',
        NewsLinkCreate.as_view(),
        name='organizer_newslink_create'),
    url(r'^(?P<startup_slug>[\w-]+)/atom/$',
        AtomStartupFeed(),
        name='organizer_startup_atom_feed'),
    url(r'^(?P<slug>[\w\-]+)/delete/$',
        StartupDelete.as_view(),
        name='organizer_startup_delete'),
    url(r'^(?P<startup_slug>[\w-]+)/rss/$',
        Rss2StartupFeed(),
        name='organizer_startup_rss_feed'),
    url(r'^(?P<slug>[\w\-]+)/update/$',
        StartupUpdate.as_view(),
        name='organizer_startup_update'),
    url(r'^(?P<startup_slug>[\w\-]+)/'
        r'(?P<newslink_slug>[\w\-]+)/'
        r'delete/$',

# Path: organizer/feeds.py
# class AtomStartupFeed(BaseStartupFeedMixin, Feed):
#     feed_type = Atom1Feed
# 
# class Rss2StartupFeed(BaseStartupFeedMixin, Feed):
#     feed_type = Rss201rev2Feed
# 
# Path: organizer/views.py
# class NewsLinkCreate(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         CreateView):
#     form_class = NewsLinkForm
#     model = NewsLink
# 
#     def get_initial(self):
#         startup_slug = self.kwargs.get(
#             self.startup_slug_url_kwarg)
#         self.startup = get_object_or_404(
#             Startup, slug__iexact=startup_slug)
#         initial = {
#             self.startup_context_object_name:
#                 self.startup,
#         }
#         initial.update(self.initial)
#         return initial
# 
# class NewsLinkDelete(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         DeleteView):
#     model = NewsLink
#     slug_url_kwarg = 'newslink_slug'
# 
#     def get_success_url(self):
#         return (self.object.startup
#                 .get_absolute_url())
# 
# class NewsLinkUpdate(
#         NewsLinkGetObjectMixin,
#         StartupContextMixin,
#         UpdateView):
#     form_class = NewsLinkForm
#     model = NewsLink
#     slug_url_kwarg = 'newslink_slug'
# 
# class StartupCreate(CreateView):
#     form_class = StartupForm
#     model = Startup
# 
# class StartupDelete(DeleteView):
#     model = Startup
#     success_url = reverse_lazy(
#         'organizer_startup_list')
# 
# class StartupDetail(DetailView):
#     queryset = (
#         Startup.objects.all()
#         .prefetch_related('tags')
#         .prefetch_related('newslink_set')
#         # below omitted because of with tag
#         # and conditional display based on time
#         # .prefetch_related('blog_posts')
#     )
# 
# class StartupList(PageLinksMixin, ListView):
#     model = Startup
#     paginate_by = 5  # 5 items per page
# 
# class StartupUpdate(UpdateView):
#     form_class = StartupForm
#     model = Startup


# Path: organizer/urls/startup.py
from django.conf.urls import url
from ..feeds import (
    AtomStartupFeed, Rss2StartupFeed)
from ..views import (
    NewsLinkCreate, NewsLinkDelete,
    NewsLinkUpdate, StartupCreate, StartupDelete,
    StartupDetail, StartupList, StartupUpdate)


urlpatterns = [
    url(r'^$',
        StartupList.as_view(),
        name='organizer_startup_list'),
    url(r'^create/$',
        StartupCreate.as_view(),
        name='organizer_startup_create'),
    url(r'^(?P<slug>[\w\-]+)/$',
        StartupDetail.as_view(),
        name='organizer_startup_detail'),
    url(r'^(?P<startup_slug>[\w\-]+)/'
        r'add_article_link/$',
        NewsLinkCreate.as_view(),
        name='organizer_newslink_create'),
    url(r'^(?P<startup_slug>[\w-]+)/atom/$',
        AtomStartupFeed(),
        name='organizer_startup_atom_feed'),
    url(r'^(?P<slug>[\w\-]+)/delete/$',
        StartupDelete.as_view(),
        name='organizer_startup_delete'),
    url(r'^(?P<startup_slug>[\w-]+)/rss/$',
        Rss2StartupFeed(),
        name='organizer_startup_rss_feed'),
    url(r'^(?P<slug>[\w\-]+)/update/$',
        StartupUpdate.as_view(),
        name='organizer_startup_update'),
    url(r'^(?P<startup_slug>[\w\-]+)/'
        r'(?P<newslink_slug>[\w\-]+)/'
        r'delete/$',

        NewsLinkDelete.as_view(),