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">
|
<div class="span-5">
|
||||||
<h1 id="logo"><a href="/">OpenStack</a></h1>
|
<h1 id="logo"><a href="/">OpenStack</a></h1>
|
||||||
</div>
|
</div>
|
||||||
<h1>Sessions for the Grizzly Design Summit</h1>
|
<h1>{{ event.title }}</h1>
|
||||||
<h3>OpenStack Conference, San Diego, Oct 15-18, 2012</h3>
|
<h3>{{ event.subtitle }}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -41,10 +41,10 @@ function overlay() {
|
|||||||
<hr>
|
<hr>
|
||||||
Need <a href='#' onclick='overlay()'>Help</a>?</br>
|
Need <a href='#' onclick='overlay()'>Help</a>?</br>
|
||||||
{% block extrafooter %}{% endblock %}
|
{% block extrafooter %}{% endblock %}
|
||||||
{% if req.user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
You are logged in as {{ req.user.username }}. <a href=/logout>Logout</A>
|
You are logged in as {{ user.username }}. <a href=/logout>Logout</A>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block formfooter %}
|
{% block formfooter %}
|
||||||
<input id="toggleButton" class="roundedButton" type="submit" value="Yes" />
|
<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 %}
|
{% endblock %}
|
||||||
|
@ -19,5 +19,5 @@ in topic <b>{{ proposal.topic }}</b></p>
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<h4>Status</h4>
|
<h4>Status</h4>
|
||||||
<p>This proposal is in <b>{{ proposal.get_status_display }}</b> state.</p>
|
<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 %}
|
{% endblock %}
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block formfooter %}
|
{% block formfooter %}
|
||||||
<input id="toggleButton" class="roundedButton" type="submit" value="Modify" />
|
<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>
|
<a class=roundedButton href="/cfp/delete/{{ proposal.id }}">Delete</A>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class=roundedButton href="/{{ req.session.lastlist }}">Cancel</A>
|
<a class=roundedButton href="/{{ request.session.lastlist }}">Cancel</A>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ proposal.topic.name }}</td>
|
<td>{{ proposal.topic.name }}</td>
|
||||||
<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 }}">
|
<a href="/cfp/edit/{{ proposal.id }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/cfp/details/{{ proposal.id }}">
|
<a href="/cfp/details/{{ proposal.id }}">
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block formfooter %}
|
{% block formfooter %}
|
||||||
<input id="toggleButton" class="roundedButton" type="submit" value="Switch" />
|
<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 %}
|
{% 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.decorators import login_required
|
||||||
from django.contrib.auth.models import User
|
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.conf import settings
|
||||||
from django.contrib.auth import logout
|
from django.contrib.auth import logout
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
@ -49,10 +49,9 @@ def list(request):
|
|||||||
reviewable_topics = Topic.objects.filter(
|
reviewable_topics = Topic.objects.filter(
|
||||||
lead_username=request.user.username)
|
lead_username=request.user.username)
|
||||||
request.session['lastlist'] = ""
|
request.session['lastlist'] = ""
|
||||||
return render_to_response("cfplist.html",
|
return render(request, "cfplist.html",
|
||||||
{'req': request,
|
{'proposals': proposals,
|
||||||
'proposals': proposals,
|
'reviewable_topics': reviewable_topics})
|
||||||
'reviewable_topics': reviewable_topics})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -62,27 +61,23 @@ def topiclist(request, topicid):
|
|||||||
return forbidden()
|
return forbidden()
|
||||||
proposals = Proposal.objects.filter(topic=topicid)
|
proposals = Proposal.objects.filter(topic=topicid)
|
||||||
request.session['lastlist'] = "cfp/topic/%s" % topicid
|
request.session['lastlist'] = "cfp/topic/%s" % topicid
|
||||||
return render_to_response("topiclist.html",
|
return render(request, "topiclist.html",
|
||||||
{'req': request,
|
{'proposals': proposals,
|
||||||
'proposals': proposals,
|
'topic': topic})
|
||||||
'topic': topic})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def topicstatus(request):
|
def topicstatus(request):
|
||||||
topics = Topic.objects.all()
|
topics = Topic.objects.all()
|
||||||
return render_to_response("topicstatus.html",
|
return render(request, "topicstatus.html", {'topics': topics})
|
||||||
{'req': request,
|
|
||||||
'topics': topics})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def details(request, proposalid):
|
def details(request, proposalid):
|
||||||
proposal = Proposal.objects.get(id=proposalid)
|
proposal = Proposal.objects.get(id=proposalid)
|
||||||
return render_to_response("cfpdetails.html",
|
return render(request, "cfpdetails.html",
|
||||||
{'req': request,
|
{'proposal': proposal,
|
||||||
'proposal': proposal,
|
'blueprints': linkify(proposal.blueprints)})
|
||||||
'blueprints': linkify(proposal.blueprints)})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -99,10 +94,7 @@ def create(request):
|
|||||||
form = ProposalForm()
|
form = ProposalForm()
|
||||||
|
|
||||||
topics = Topic.objects.all()
|
topics = Topic.objects.all()
|
||||||
return render_to_response('cfpcreate.html',
|
return render(request, 'cfpcreate.html', {'topics': topics, 'form': form})
|
||||||
{'req': request,
|
|
||||||
'topics': topics,
|
|
||||||
'form': form})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -118,10 +110,8 @@ def edit(request, proposalid):
|
|||||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||||
else:
|
else:
|
||||||
form = ProposalEditForm(instance=proposal)
|
form = ProposalEditForm(instance=proposal)
|
||||||
return render_to_response('cfpedit.html',
|
return render(request, 'cfpedit.html', {'form': form,
|
||||||
{'req': request,
|
'proposal': proposal})
|
||||||
'form': form,
|
|
||||||
'proposal': proposal})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -132,9 +122,7 @@ def delete(request, proposalid):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
proposal.delete()
|
proposal.delete()
|
||||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||||
return render_to_response('cfpdelete.html',
|
return render(request, 'cfpdelete.html', {'proposal': proposal})
|
||||||
{'req': request,
|
|
||||||
'proposal': proposal})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -153,10 +141,8 @@ def switch(request, proposalid):
|
|||||||
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
return HttpResponseRedirect('/%s' % request.session['lastlist'])
|
||||||
else:
|
else:
|
||||||
form = ProposalSwitchForm(instance=proposal)
|
form = ProposalSwitchForm(instance=proposal)
|
||||||
return render_to_response('cfpswitch.html',
|
return render(request, 'cfpswitch.html', {'form': form,
|
||||||
{'req': request,
|
'proposal': proposal})
|
||||||
'form': form,
|
|
||||||
'proposal': proposal})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -199,11 +185,10 @@ You can edit your proposal at: %s/cfp/edit/%s""" \
|
|||||||
return HttpResponseRedirect('/cfp/topic/%d' % proposal.topic.id)
|
return HttpResponseRedirect('/cfp/topic/%d' % proposal.topic.id)
|
||||||
else:
|
else:
|
||||||
form = ProposalReviewForm(instance=proposal)
|
form = ProposalReviewForm(instance=proposal)
|
||||||
return render_to_response('cfpreview.html',
|
return render(request, 'cfpreview.html',
|
||||||
{'req': request,
|
{'form': form,
|
||||||
'form': form,
|
'proposal': proposal,
|
||||||
'proposal': proposal,
|
'blueprints': linkify(proposal.blueprints)})
|
||||||
'blueprints': linkify(proposal.blueprints)})
|
|
||||||
|
|
||||||
|
|
||||||
def dologout(request):
|
def dologout(request):
|
||||||
|
@ -32,7 +32,9 @@ DEBUG = False
|
|||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
#OPENID_USE_AS_ADMIN_LOGIN = True
|
#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_URL = "essexdesignsummit"
|
||||||
SCHED_API_KEY = "getThisFromSched"
|
SCHED_API_KEY = "getThisFromSched"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
@ -91,11 +91,10 @@ def scheduling(request, topicid):
|
|||||||
accepted = Proposal.objects.filter(status='A', scheduled=False,
|
accepted = Proposal.objects.filter(status='A', scheduled=False,
|
||||||
topic=topic)
|
topic=topic)
|
||||||
schedule = Slot.objects.filter(topic=topic)
|
schedule = Slot.objects.filter(topic=topic)
|
||||||
return render_to_response("scheduling.html",
|
return render(request, "scheduling.html",
|
||||||
{'req': request,
|
{'accepted': accepted,
|
||||||
'accepted': accepted,
|
'schedule': schedule,
|
||||||
'schedule': schedule,
|
'topic': topic})
|
||||||
'topic': topic})
|
|
||||||
|
|
||||||
|
|
||||||
def end_time(start_time):
|
def end_time(start_time):
|
||||||
@ -140,10 +139,9 @@ def publish(request, topicid):
|
|||||||
f.close()
|
f.close()
|
||||||
f = urllib2.urlopen(baseurl + "add", data)
|
f = urllib2.urlopen(baseurl + "add", data)
|
||||||
f.close()
|
f.close()
|
||||||
return render_to_response("sched.html",
|
return render(request, "sched.html",
|
||||||
{'req': request,
|
{'list_calls': list_calls,
|
||||||
'list_calls': list_calls,
|
'topic': topic})
|
||||||
'topic': topic})
|
|
||||||
|
|
||||||
|
|
||||||
def edit(request, slotid):
|
def edit(request, slotid):
|
||||||
@ -157,12 +155,11 @@ def edit(request, slotid):
|
|||||||
return HttpResponseRedirect('/scheduling/%s' % slot.topic.id)
|
return HttpResponseRedirect('/scheduling/%s' % slot.topic.id)
|
||||||
else:
|
else:
|
||||||
form = SlotForm(instance=slot)
|
form = SlotForm(instance=slot)
|
||||||
return render_to_response('slotedit.html',
|
return render(request, 'slotedit.html',
|
||||||
{'req': request,
|
{'form': form,
|
||||||
'form': form,
|
'title': combined_title(slot),
|
||||||
'title': combined_title(slot),
|
'full_desc': combined_description(slot),
|
||||||
'full_desc': combined_description(slot),
|
'slot': slot})
|
||||||
'slot': slot})
|
|
||||||
|
|
||||||
|
|
||||||
def swap(request, slotid):
|
def swap(request, slotid):
|
||||||
@ -188,11 +185,10 @@ def swap(request, slotid):
|
|||||||
for slot in available_slots:
|
for slot in available_slots:
|
||||||
triplet = (slot.start_time, slot.id, combined_title(slot))
|
triplet = (slot.start_time, slot.id, combined_title(slot))
|
||||||
newslots.append(triplet)
|
newslots.append(triplet)
|
||||||
return render_to_response('slotswap.html',
|
return render(request, 'slotswap.html',
|
||||||
{'req': request,
|
{'title': combined_title(oldslot),
|
||||||
'title': combined_title(oldslot),
|
'oldslot': oldslot,
|
||||||
'oldslot': oldslot,
|
'newslots': newslots})
|
||||||
'newslots': newslots})
|
|
||||||
|
|
||||||
|
|
||||||
def graph(request, topicid):
|
def graph(request, topicid):
|
||||||
@ -215,7 +211,4 @@ def graph(request, topicid):
|
|||||||
nbproposed += 1
|
nbproposed += 1
|
||||||
stats['max'] = max(stats['avail'], nbproposed + nbscheduled)
|
stats['max'] = max(stats['avail'], nbproposed + nbscheduled)
|
||||||
|
|
||||||
return render_to_response("graph.html",
|
return render(request, "graph.html", {'stats': stats, 'topic': topic})
|
||||||
{'req': request,
|
|
||||||
'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_URL = "essexdesignsummit"
|
||||||
SCHED_API_KEY = "getThisFromSched"
|
SCHED_API_KEY = "getThisFromSched"
|
||||||
|
|
||||||
@ -56,6 +59,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||||||
"django.core.context_processors.i18n",
|
"django.core.context_processors.i18n",
|
||||||
"django.core.context_processors.media",
|
"django.core.context_processors.media",
|
||||||
"django.core.context_processors.request",
|
"django.core.context_processors.request",
|
||||||
|
"cfp.context_processors.event",
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user