Commit d8c97c5c authored by chris's avatar chris

flyers/urls: [breaky] refactor for new syntax: i18n, autodiscover, static media

parent c6c486be
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.views.generic import DetailView
from django.shortcuts import get_object_or_404
from flyers.content.models import Page
from flyers.general.models import Settings
from django.contrib import admin
admin.autodiscover()
from django.views.i18n import JavaScriptCatalog
from django.conf.urls.i18n import i18n_patterns
import settings
class HomepageDetail(DetailView):
model = Page
def get_object(self):
settings = Settings.objects.get(pk=1)
if settings.home_page:
......@@ -20,16 +23,19 @@ urlpatterns = [
# url(r'^$', 'flyers.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
#url(r'^$', TemplateView.as_view(template_name='homepage.html')),
(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^$', HomepageDetail.as_view()),
url(r'^(?P<slug>.+)/$', DetailView.as_view(model=Page)),
]
import settings
urlpatterns += i18n_patterns(
url(r'^jsi18n/$', JavaScriptCatalog.as_view(),
name='javascript-catalog'),
)
if settings.DEBUG:
urlpatterns += [
url(r'^media/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, }),
]
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Serve static and media files from development server
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment