diff --git a/cms_pages/models.py b/cms_pages/models.py index 71c5d0e1..1f8fd2d5 100644 --- a/cms_pages/models.py +++ b/cms_pages/models.py @@ -1,6 +1,8 @@ from __future__ import unicode_literals +from django.http import Http404 from django.db import models +from django.shortcuts import render from modelcluster.fields import ParentalKey @@ -10,6 +12,7 @@ from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.models import Orderable from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailcore.fields import StreamField +from wagtail.wagtailcore.url_routing import RouteResult from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailadmin.edit_handlers import InlinePanel from wagtail.wagtailadmin.edit_handlers import FieldPanel @@ -17,7 +20,6 @@ from wagtail.wagtailadmin.edit_handlers import PageChooserPanel from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel from wagtail.wagtailsearch import index - ILLUSTRATION_ANTARCTICA = "antarctica.svg" ILLUSTRATION_BRIDGE = "bridge.svg" ILLUSTRATION_CASINO = "casino.svg" @@ -152,6 +154,32 @@ class ContentPage(AbstractContentPage): class NewsIndexPage(AbstractContentPage): + def route(self, request, path_components): + + # Try the default to allow children to resolve + try: + return super(NewsIndexPage, self).route(request, path_components) + except Http404: + pass + + if path_components: + # tell Wagtail to call self.serve() with an additional 'path_components' kwarg + return RouteResult(self, kwargs={'path_components': path_components}) + else: + raise Http404 + + def serve(self, request, path_components=[]): + ''' Optionally return the RSS version of the page ''' + + template = self.template + + if path_components and path_components[0] == "rss": + template = template.replace(".html", ".rss") + + r = super(NewsIndexPage, self).serve(request) + r.template_name = template + return r + def child_pages(self): return NewsPage.objects.live().child_of(self).specific().order_by("-date") diff --git a/pinaxcon/monkey_patch.py b/pinaxcon/monkey_patch.py index fa66128c..343968d8 100644 --- a/pinaxcon/monkey_patch.py +++ b/pinaxcon/monkey_patch.py @@ -14,6 +14,7 @@ def do_monkey_patch(): patch_speaker_profile_form() patch_accounts_to_send_bcc() fix_sitetree_check_access_500s() + never_cache_login_page() # Remove this function from existence global do_monkey_patch @@ -76,3 +77,8 @@ def fix_sitetree_check_access_500s(): return False SiteTree.check_access = check_access + +def never_cache_login_page(): + from django.views.decorators.cache import never_cache + from account.views import LoginView + LoginView.get = never_cache(LoginView.get) diff --git a/pinaxcon/proposals/admin.py b/pinaxcon/proposals/admin.py index 2657dc6c..a65159f7 100644 --- a/pinaxcon/proposals/admin.py +++ b/pinaxcon/proposals/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin -from .models import TalkProposal +import models - -admin.site.register(TalkProposal) +admin.site.register(models.TalkProposal) +admin.site.register(models.TutorialProposal) +admin.site.register(models.MiniconfProposal) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index b8433082..9aa64b5c 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -115,7 +115,6 @@ MIDDLEWARE_CLASSES = [ 'wagtail.wagtailcore.middleware.SiteMiddleware', 'wagtail.wagtailredirects.middleware.RedirectMiddleware', 'pinaxcon.monkey_patch.MonkeyPatchMiddleware', - 'pinaxcon.disable_cscache.DisableClientSideCachingMiddleware', ] ROOT_URLCONF = "pinaxcon.urls" diff --git a/pinaxcon/templates/_form_snippet.html b/pinaxcon/templates/_form_snippet.html index f8ca2d80..0c561983 100644 --- a/pinaxcon/templates/_form_snippet.html +++ b/pinaxcon/templates/_form_snippet.html @@ -1,5 +1,3 @@ -{% load lca2017_tags %} - {% if form.non_field_errors %} {{ form.non_field_errors }}
@@ -9,16 +7,7 @@ {% if not field.is_hidden %}
- {% classname field.field.widget as widget %} - {% if widget != "CheckboxInput" %} -

- {{ field.errors }} - {{ field }} - {% else %} - - {{ field }} - {{ field.errors }} - {% endif %} + {% include "forms/widget.html" %}
{% if field.help_text %} diff --git a/pinaxcon/templates/cms_pages/news_index_page.html b/pinaxcon/templates/cms_pages/news_index_page.html index bf35eaa4..517ffd7d 100644 --- a/pinaxcon/templates/cms_pages/news_index_page.html +++ b/pinaxcon/templates/cms_pages/news_index_page.html @@ -36,5 +36,12 @@
{% endif %} +
+
+

Subscribe

+

View as RSS

+
+
+ {% endblock %} {% endblock %} diff --git a/pinaxcon/templates/cms_pages/news_index_page.rss b/pinaxcon/templates/cms_pages/news_index_page.rss new file mode 100644 index 00000000..616dcb1f --- /dev/null +++ b/pinaxcon/templates/cms_pages/news_index_page.rss @@ -0,0 +1,35 @@ +{% load wagtailcore_tags %} +{% load i18n %} + + + + + {{ SITE_NAME }} | {{ page.title }} + + {{ request.scheme }}://{{ request.get_host }} + Recent content from {{ SITE_NAME }} + {{ SITE_NAME }} + + + + {% if page.child_pages %} + {% for item in page.child_pages %} + + {{ item.title }} + {{ request.scheme }}://{{ request.get_host }}{{ item.url }} + {{ request.scheme }}://{{ request.get_host }}{{ item.url }} + {{ item.date|date:"D, d M Y 00:00:00 +1000" }} + + <p> + {{ item.intro|richtext|force_escape }} + </p> + <p> + {{ item.body|richtext|force_escape }} + </p> + + + + {% endfor %} + {% endif %} + + diff --git a/pinaxcon/templates/forms/widget.html b/pinaxcon/templates/forms/widget.html new file mode 100644 index 00000000..028c820d --- /dev/null +++ b/pinaxcon/templates/forms/widget.html @@ -0,0 +1,12 @@ +{% load lca2017_tags %} + +{% classname field.field.widget as widget %} +{% if widget == "CheckboxInput" %} + {% include "forms/widget_boolean_single.html" %} +{% elif widget == "RadioSelect" %} + {% include "forms/widget_boolean_multiple.html" %} +{% elif widget == "Select" or widget == "SelectMultiple" %} + {% include "forms/widget_basic.html" with widget_class="select" %} +{% else %} + {% include "forms/widget_basic.html" %} +{% endif %} diff --git a/pinaxcon/templates/forms/widget_basic.html b/pinaxcon/templates/forms/widget_basic.html new file mode 100644 index 00000000..91aa02b6 --- /dev/null +++ b/pinaxcon/templates/forms/widget_basic.html @@ -0,0 +1,3 @@ +

+{{ field.errors }} +
{{ field }}
diff --git a/pinaxcon/templates/forms/widget_boolean_multiple.html b/pinaxcon/templates/forms/widget_boolean_multiple.html new file mode 100644 index 00000000..ae361f2e --- /dev/null +++ b/pinaxcon/templates/forms/widget_boolean_multiple.html @@ -0,0 +1,11 @@ +

+ +{{ field.errors }} diff --git a/pinaxcon/templates/forms/widget_boolean_single.html b/pinaxcon/templates/forms/widget_boolean_single.html new file mode 100644 index 00000000..a348dffc --- /dev/null +++ b/pinaxcon/templates/forms/widget_boolean_single.html @@ -0,0 +1,7 @@ + +{{ field.errors }} diff --git a/pinaxcon/templates/sitetree_header.html b/pinaxcon/templates/sitetree_header.html index bdf1213d..1c9f5661 100644 --- a/pinaxcon/templates/sitetree_header.html +++ b/pinaxcon/templates/sitetree_header.html @@ -13,8 +13,10 @@ {% if item.has_children %} + {% with is_last=forloop.last %} {% sitetree_children of item for menu template "sitetree_header_dropdown.html" %} + {% endwith %} {% endif %} - + {% endfor %} diff --git a/pinaxcon/templates/sitetree_header_dropdown.html b/pinaxcon/templates/sitetree_header_dropdown.html index 237cc731..5739eb80 100644 --- a/pinaxcon/templates/sitetree_header_dropdown.html +++ b/pinaxcon/templates/sitetree_header_dropdown.html @@ -1,5 +1,6 @@ {% load sitetree %} -