Make event name configurable
Event name is now configurable in settings.py. Uses the render() shortcut (RequestContext) and a new context processor to pass event to all templates.
This commit is contained in:
parent
b6e74c198d
commit
f91c04df5b
20
cfp/context_processors.py
Normal file
20
cfp/context_processors.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright 2012 Thierry Carrez <thierry@openstack.org>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def event(request):
|
||||
return {'event': {'title': settings.EVENT_TITLE,
|
||||
'subtitle': settings.EVENT_SUBTITLE}}
|
@ -17,8 +17,8 @@ function overlay() {
|
||||
<div class="span-5">
|
||||
<h1 id="logo"><a href="/">OpenStack</a></h1>
|
||||
</div>
|
||||
<h1>Sessions for the Grizzly Design Summit</h1>
|
||||
<h3>OpenStack Conference, San Diego, Oct 15-18, 2012</h3>
|
||||
<h1>{{ event.title }}</h1>
|
||||
<h3>{{ event.subtitle }}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -41,10 +41,10 @@ function overlay() {
|
||||
<hr>
|
||||
Need <a href='#' onclick='overlay()'>Help</a>?</br>
|
||||
{% block extrafooter %}{% endblock %}
|
||||
{% if req.user.is_authenticated %}
|
||||
You are logged in as {{ req.user.username }}. <a href=/logout>Logout</A>
|
||||
{% if user.is_authenticated %}
|
||||
You are logged in as {{ user.username }}. <a href=/logout>Logout</A>
|
||||
{% else %}
|
||||
You are not logged in. <a href="/openid/login?next={{ req.path }}">Log in</A>
|
||||
You are not logged in. <a href="/openid/login?next={{request.path}}">Log in</A>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,5 +8,5 @@
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
<input id="toggleButton" class="roundedButton" type="submit" value="Yes" />
|
||||
<a class=roundedButton href="/{{ req.session.lastlist }}">Cancel</A>
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Cancel</A>
|
||||
{% endblock %}
|
||||
|
@ -19,5 +19,5 @@ in topic <b>{{ proposal.topic }}</b></p>
|
||||
{% endif %}
|
||||
<h4>Status</h4>
|
||||
<p>This proposal is in <b>{{ proposal.get_status_display }}</b> state.</p>
|
||||
<a class=roundedButton href="/{{ req.session.lastlist }}">Back</A>
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Back</A>
|
||||
{% endblock %}
|
||||
|
@ -13,8 +13,8 @@
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
<input id="toggleButton" class="roundedButton" type="submit" value="Modify" />
|
||||
{% if proposal.proposer == req.user and proposal.status != 'A' and proposal.status != 'S' %}
|
||||
{% if proposal.proposer == user and proposal.status != 'A' and proposal.status != 'S' %}
|
||||
<a class=roundedButton href="/cfp/delete/{{ proposal.id }}">Delete</A>
|
||||
{% endif %}
|
||||
<a class=roundedButton href="/{{ req.session.lastlist }}">Cancel</A>
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Cancel</A>
|
||||
{% endblock %}
|
||||
|
@ -31,7 +31,7 @@
|
||||
<tr>
|
||||
<td>{{ proposal.topic.name }}</td>
|
||||
<td>
|
||||
{% if proposal.proposer == req.user and proposal.status != 'A' %}
|
||||
{% if proposal.proposer == user and proposal.status != 'A' %}
|
||||
<a href="/cfp/edit/{{ proposal.id }}">
|
||||
{% else %}
|
||||
<a href="/cfp/details/{{ proposal.id }}">
|
||||
|
@ -9,5 +9,5 @@
|
||||
{% endblock %}
|
||||
{% block formfooter %}
|
||||
<input id="toggleButton" class="roundedButton" type="submit" value="Switch" />
|
||||
<a class=roundedButton href="/{{ req.session.lastlist }}">Cancel</A>
|
||||
<a class=roundedButton href="/{{ request.session.lastlist }}">Cancel</A>
|
||||
{% endblock %}
|
||||
|
57
cfp/views.py
57
cfp/views.py
@ -15,7 +15,7 @@
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import render_to_response
|
||||
from django.shortcuts import render
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import logout
|
||||
from django.core.mail import EmailMessage
|
||||
@ -49,10 +49,9 @@ def list(request):
|
||||
reviewable_topics = Topic.objects.filter(
|
||||
lead_username=request.user.username)
|
||||
request.session['lastlist'] = ""
|
||||
return render_to_response("cfplist.html",
|
||||
{'req': request,
|
||||
'proposals': proposals,
|
||||
'reviewable_topics': reviewable_topics})
|
||||
return render(request, "cfplist.html",
|
||||
{'proposals': proposals,
|
||||
'reviewable_topics': reviewable_topics})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -62,27 +61,23 @@ def topiclist(request, topicid):
|
||||
return forbidden()
|
||||
proposals = Proposal.objects.filter(topic=topicid)
|
||||
request.session['lastlist'] = "cfp/topic/%s" % topicid
|
||||
return render_to_response("topiclist.html",
|
||||
{'req': request,
|
||||
'proposals': proposals,
|
||||
'topic': topic})
|
||||
return render(request, "topiclist.html",
|
||||
{'proposals': proposals,
|
||||
'topic': topic})
|
||||
|
||||
|
||||
@login_required
|
||||
def topicstatus(request):
|
||||
topics = Topic.objects.all()
|
||||
return render_to_response("topicstatus.html",
|
||||
{'req': request,
|
||||
'topics': topics})
|
||||
return render(request, "topicstatus.html", {'topics': topics})
|
||||
|
||||
|
||||
@login_required
|
||||
def details(request, proposalid):
|
||||
proposal = Proposal.objects.get(id=proposalid)
|
||||
return render_to_response("cfpdetails.html",
|
||||
{'req': request,
|
||||
'proposal': proposal,
|
||||
'blueprints': linkify(proposal.blueprints)})
|
||||
return render(request, "cfpdetails.html",
|
||||
{'proposal': proposal,
|
||||
'blueprints': linkify(proposal.blueprints)})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -99,10 +94,7 @@ def create(request):
|
||||
form = ProposalForm()
|
||||
|
||||
topics = Topic.objects.all()
|
||||
return render_to_response('cfpcreate.html',
|
||||
{'req': request,
|
||||
'topics': topics,
|
||||
'form': form})
|
||||
return render(request, 'cfpcreate.html', {'topics': topics, 'form': form})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -118,10 +110,8 @@ def edit(request, proposalid):
|
||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||
else:
|
||||
form = ProposalEditForm(instance=proposal)
|
||||
return render_to_response('cfpedit.html',
|
||||
{'req': request,
|
||||
'form': form,
|
||||
'proposal': proposal})
|
||||
return render(request, 'cfpedit.html', {'form': form,
|
||||
'proposal': proposal})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -132,9 +122,7 @@ def delete(request, proposalid):
|
||||
if request.method == 'POST':
|
||||
proposal.delete()
|
||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||
return render_to_response('cfpdelete.html',
|
||||
{'req': request,
|
||||
'proposal': proposal})
|
||||
return render(request, 'cfpdelete.html', {'proposal': proposal})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -153,10 +141,8 @@ def switch(request, proposalid):
|
||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||
else:
|
||||
form = ProposalSwitchForm(instance=proposal)
|
||||
return render_to_response('cfpswitch.html',
|
||||
{'req': request,
|
||||
'form': form,
|
||||
'proposal': proposal})
|
||||
return render(request, 'cfpswitch.html', {'form': form,
|
||||
'proposal': proposal})
|
||||
|
||||
|
||||
@login_required
|
||||
@ -199,11 +185,10 @@ You can edit your proposal at: %s/cfp/edit/%s""" \
|
||||
return HttpResponseRedirect('/cfp/topic/%d' % proposal.topic.id)
|
||||
else:
|
||||
form = ProposalReviewForm(instance=proposal)
|
||||
return render_to_response('cfpreview.html',
|
||||
{'req': request,
|
||||
'form': form,
|
||||
'proposal': proposal,
|
||||
'blueprints': linkify(proposal.blueprints)})
|
||||
return render(request, 'cfpreview.html',
|
||||
{'form': form,
|
||||
'proposal': proposal,
|
||||
'blueprints': linkify(proposal.blueprints)})
|
||||
|
||||
|
||||
def dologout(request):
|
||||
|
@ -32,7 +32,9 @@ DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
#OPENID_USE_AS_ADMIN_LOGIN = True
|
||||
|
||||
# Change to match your Sched event
|
||||
# Change to match your event
|
||||
EVENT_TITLE = "Grizzly Design Summit"
|
||||
EVENT_SUBTITLE = "OpenStack Summit, San Diego, Oct 15-18, 2012"
|
||||
SCHED_URL = "essexdesignsummit"
|
||||
SCHED_API_KEY = "getThisFromSched"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
from django.shortcuts import render_to_response
|
||||
from django.shortcuts import render
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.encoding import smart_str
|
||||
@ -91,11 +91,10 @@ def scheduling(request, topicid):
|
||||
accepted = Proposal.objects.filter(status='A', scheduled=False,
|
||||
topic=topic)
|
||||
schedule = Slot.objects.filter(topic=topic)
|
||||
return render_to_response("scheduling.html",
|
||||
{'req': request,
|
||||
'accepted': accepted,
|
||||
'schedule': schedule,
|
||||
'topic': topic})
|
||||
return render(request, "scheduling.html",
|
||||
{'accepted': accepted,
|
||||
'schedule': schedule,
|
||||
'topic': topic})
|
||||
|
||||
|
||||
def end_time(start_time):
|
||||
@ -140,10 +139,9 @@ def publish(request, topicid):
|
||||
f.close()
|
||||
f = urllib2.urlopen(baseurl + "add", data)
|
||||
f.close()
|
||||
return render_to_response("sched.html",
|
||||
{'req': request,
|
||||
'list_calls': list_calls,
|
||||
'topic': topic})
|
||||
return render(request, "sched.html",
|
||||
{'list_calls': list_calls,
|
||||
'topic': topic})
|
||||
|
||||
|
||||
def edit(request, slotid):
|
||||
@ -157,12 +155,11 @@ def edit(request, slotid):
|
||||
return HttpResponseRedirect('/scheduling/%s' % slot.topic.id)
|
||||
else:
|
||||
form = SlotForm(instance=slot)
|
||||
return render_to_response('slotedit.html',
|
||||
{'req': request,
|
||||
'form': form,
|
||||
'title': combined_title(slot),
|
||||
'full_desc': combined_description(slot),
|
||||
'slot': slot})
|
||||
return render(request, 'slotedit.html',
|
||||
{'form': form,
|
||||
'title': combined_title(slot),
|
||||
'full_desc': combined_description(slot),
|
||||
'slot': slot})
|
||||
|
||||
|
||||
def swap(request, slotid):
|
||||
@ -188,11 +185,10 @@ def swap(request, slotid):
|
||||
for slot in available_slots:
|
||||
triplet = (slot.start_time, slot.id, combined_title(slot))
|
||||
newslots.append(triplet)
|
||||
return render_to_response('slotswap.html',
|
||||
{'req': request,
|
||||
'title': combined_title(oldslot),
|
||||
'oldslot': oldslot,
|
||||
'newslots': newslots})
|
||||
return render(request, 'slotswap.html',
|
||||
{'title': combined_title(oldslot),
|
||||
'oldslot': oldslot,
|
||||
'newslots': newslots})
|
||||
|
||||
|
||||
def graph(request, topicid):
|
||||
@ -215,7 +211,4 @@ def graph(request, topicid):
|
||||
nbproposed += 1
|
||||
stats['max'] = max(stats['avail'], nbproposed + nbscheduled)
|
||||
|
||||
return render_to_response("graph.html",
|
||||
{'req': request,
|
||||
'stats': stats,
|
||||
'topic': topic})
|
||||
return render(request, "graph.html", {'stats': stats, 'topic': topic})
|
||||
|
@ -34,6 +34,9 @@ DATABASES = {
|
||||
}
|
||||
}
|
||||
|
||||
EVENT_TITLE = "Grizzly Design Summit"
|
||||
EVENT_SUBTITLE = "OpenStack Summit, San Diego, Oct 15-18, 2012"
|
||||
|
||||
SCHED_URL = "essexdesignsummit"
|
||||
SCHED_API_KEY = "getThisFromSched"
|
||||
|
||||
@ -56,6 +59,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
"django.core.context_processors.i18n",
|
||||
"django.core.context_processors.media",
|
||||
"django.core.context_processors.request",
|
||||
"cfp.context_processors.event",
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user