import django
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

if django.VERSION[:2] > (1, 9):
    from django.views.i18n import JavaScriptCatalog
else:
    from django.views.i18n import javascript_catalog
    
from django_comments_xtd import LatestCommentFeed
from django_comments_xtd.views import XtdCommentListView

from comp import views


admin.autodiscover()


urlpatterns = [
    url(r'^$', views.HomepageView.as_view(), name='homepage'),
    url(r'^i18n/', include('django.conf.urls.i18n')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^articles/', include('comp.articles.urls')),
    url(r'^quotes/', include('comp.quotes.urls')),
    url(r'^comments/', include('django_comments_xtd.urls')),
    url(r'^comments/$', XtdCommentListView.as_view(
        content_types=["articles.article", "quotes.quote"],
        paginate_by=10, page_range=5),
        name='comments-xtd-list'),
    url(r'^feeds/comments/$', LatestCommentFeed(), name='comments-feed'),    
    url(r'^api-auth/', include('rest_framework.urls',
                               namespace='rest_framework')),
]

if django.VERSION[:2] > (1, 9):
    urlpatterns.append(
        url(r'^jsi18n/$', JavaScriptCatalog.as_view(),
            name='javascript-catalog')
    )
else:
    js_info_dict = {
        'packages': ('django_comments_xtd',)
    }
    urlpatterns.append(
        url(r'^jsi18n/$', javascript_catalog, js_info_dict,
            name='javascript-catalog')
    )

if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns()

if 'rosetta' in settings.INSTALLED_APPS:
    urlpatterns += [url(r'^rosetta/', include('rosetta.urls'))]

[(18, 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), False, 'from django.contrib import admin\n'), (52, 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), False, 'from django.contrib.staticfiles.urls import staticfiles_urlpatterns\n'), (22, 'comp.views.HomepageView.as_view', 'views.HomepageView.as_view', ([], {}), False, 'from comp import views\n'), (23, 'django.conf.urls.include', 'include', (['"""django.conf.urls.i18n"""'], {}), False, 'from django.conf.urls import include, url\n'), (24, 'django.conf.urls.include', 'include', (['admin.site.urls'], {}), False, 'from django.conf.urls import include, url\n'), (25, 'django.conf.urls.include', 'include', (['"""comp.articles.urls"""'], {}), False, 'from django.conf.urls import include, url\n'), (26, 'django.conf.urls.include', 'include', (['"""comp.quotes.urls"""'], {}), False, 'from django.conf.urls import include, url\n'), (27, 'django.conf.urls.include', 'include', (['"""django_comments_xtd.urls"""'], {}), False, 'from django.conf.urls import include, url\n'), (28, 'django_comments_xtd.views.XtdCommentListView.as_view', 'XtdCommentListView.as_view', ([], {'content_types': "['articles.article', 'quotes.quote']", 'paginate_by': '(10)', 'page_range': '(5)'}), False, 'from django_comments_xtd.views import XtdCommentListView\n'), (32, 'django_comments_xtd.LatestCommentFeed', 'LatestCommentFeed', ([], {}), False, 'from django_comments_xtd import LatestCommentFeed\n'), (33, 'django.conf.urls.include', 'include', (['"""rest_framework.urls"""'], {'namespace': '"""rest_framework"""'}), False, 'from django.conf.urls import include, url\n'), (47, 'django.conf.urls.url', 'url', (['"""^jsi18n/$"""', 'javascript_catalog', 'js_info_dict'], {'name': '"""javascript-catalog"""'}), False, 'from django.conf.urls import include, url\n'), (39, 'django.views.i18n.JavaScriptCatalog.as_view', 'JavaScriptCatalog.as_view', ([], {}), False, 'from django.views.i18n import JavaScriptCatalog\n'), (55, 'django.conf.urls.include', 'include', (['"""rosetta.urls"""'], {}), False, 'from django.conf.urls import include, url\n')]