Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding messages to home pages #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ilpycon/symposion/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import unicode_literals

from django.shortcuts import render, redirect
from django.views.generic.base import TemplateView
from pinax.pages.models import Page


from account.decorators import login_required
Expand All @@ -11,3 +13,17 @@ def dashboard(request):
if request.session.get("pending-token"):
return redirect("speaker_create_token", request.session["pending-token"])
return render(request, "dashboard.html")


class HomePage(TemplateView):
template_name = 'homepage.html'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
messages_en = Page.published.filter(title='messages')
if messages_en:
context['conf_messages'] = messages_en[0].body_html
messages_he = Page.published.filter(title='messages_hebrew')
if messages_he:
context['conf_messages_hebrew'] = messages_he[0].body_html
return context
5 changes: 5 additions & 0 deletions ilpycon/templates/homepage_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ <h1>PyCon Israel 2018</h1>
</div>
</section>
<section id="content-section">
{% if conf_messages %}
<div class="container">
{{ conf_messages|safe }}
</div>
{% endif %}
<div id="content-body">
<p class="lead">
Join us for two days of learning from world-class keynotes and miryad presentations,
Expand Down
5 changes: 5 additions & 0 deletions ilpycon/templates/homepage_he.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ <h1>PyCon ישראל 2018</h1>
</div>
</section>
<section id="content-section">
{% if conf_messages_hebrew %}
<div class="container">
{{ conf_messages_hebrew|safe }}
</div>
{% endif %}
<div id="content-body">
<p class="lead">
הצטרפו אלינו ליומיים של לימוד ממרצים אורחים ברמה עולמית, והרצאות רבות ומגוונות,
Expand Down
3 changes: 2 additions & 1 deletion ilpycon/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path
from django.conf.urls.static import static
from ilpycon.symposion.views import HomePage
from django.views.generic import TemplateView

from django.contrib import admin
Expand All @@ -15,7 +16,7 @@
WIKI_SLUG = r"(([\w-]{2,})(/[\w-]{2,})*)"

urlpatterns = i18n_patterns(
path("", TemplateView.as_view(template_name="homepage.html"), name="home"),
path("", HomePage.as_view(), name="home"),
path("speakers/", include("ilpycon.symposion.speakers.urls")),
path("dashboard/", dashboard, name="dashboard"),
)
Expand Down