got sponsorship app flow working, adding missing templates, etc
This commit is contained in:
parent
b9fe28b4a9
commit
9d367667f2
9 changed files with 226 additions and 16 deletions
35
fixtures/sponsor_levels.json
Normal file
35
fixtures/sponsor_levels.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"pk": 1,
|
||||||
|
"model": "sponsorship.sponsorlevel",
|
||||||
|
"fields": {
|
||||||
|
"conference": 1,
|
||||||
|
"description": "",
|
||||||
|
"cost": 10000,
|
||||||
|
"name": "Gold",
|
||||||
|
"order": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pk": 2,
|
||||||
|
"model": "sponsorship.sponsorlevel",
|
||||||
|
"fields": {
|
||||||
|
"conference": 1,
|
||||||
|
"description": "",
|
||||||
|
"cost": 5000,
|
||||||
|
"name": "Silver",
|
||||||
|
"order": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pk": 3,
|
||||||
|
"model": "sponsorship.sponsorlevel",
|
||||||
|
"fields": {
|
||||||
|
"conference": 1,
|
||||||
|
"description": "",
|
||||||
|
"cost": 2000,
|
||||||
|
"name": "Bronze",
|
||||||
|
"order": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -26,7 +26,7 @@ class SponsorLevel(models.Model):
|
||||||
verbose_name_plural = _("sponsor levels")
|
verbose_name_plural = _("sponsor levels")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s %s" % (self.conference, self.name)
|
return self.name
|
||||||
|
|
||||||
def sponsors(self):
|
def sponsors(self):
|
||||||
return self.sponsor_set.filter(active=True).order_by("added")
|
return self.sponsor_set.filter(active=True).order_by("added")
|
||||||
|
@ -62,6 +62,48 @@ class Sponsor(models.Model):
|
||||||
return reverse("sponsor_detail", kwargs={"pk": self.pk})
|
return reverse("sponsor_detail", kwargs={"pk": self.pk})
|
||||||
return reverse("sponsor_list")
|
return reverse("sponsor_list")
|
||||||
|
|
||||||
|
def reset_benefits(self):
|
||||||
|
"""
|
||||||
|
Reset all benefits for this sponsor to the defaults for their
|
||||||
|
sponsorship level.
|
||||||
|
"""
|
||||||
|
level = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
level = self.level
|
||||||
|
except SponsorLevel.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
|
allowed_benefits = []
|
||||||
|
if level:
|
||||||
|
for benefit_level in level.benefit_levels.all():
|
||||||
|
# Create all needed benefits if they don't exist already
|
||||||
|
sponsor_benefit, created = SponsorBenefit.objects.get_or_create(
|
||||||
|
sponsor=self, benefit=benefit_level.benefit)
|
||||||
|
|
||||||
|
# and set to default limits for this level.
|
||||||
|
sponsor_benefit.max_words = benefit_level.max_words
|
||||||
|
sponsor_benefit.other_limits = benefit_level.other_limits
|
||||||
|
|
||||||
|
# and set to active
|
||||||
|
sponsor_benefit.active = True
|
||||||
|
|
||||||
|
# @@@ We don't call sponsor_benefit.clean here. This means
|
||||||
|
# that if the sponsorship level for a sponsor is adjusted
|
||||||
|
# downwards, an existing too-long text entry can remain,
|
||||||
|
# and won't raise a validation error until it's next
|
||||||
|
# edited.
|
||||||
|
sponsor_benefit.save()
|
||||||
|
|
||||||
|
allowed_benefits.append(sponsor_benefit.pk)
|
||||||
|
|
||||||
|
# Any remaining sponsor benefits that don't normally belong to
|
||||||
|
# this level are set to inactive
|
||||||
|
self.sponsor_benefits.exclude(pk__in=allowed_benefits).update(active=False, max_words=None, other_limits="")
|
||||||
|
|
||||||
|
def send_coordinator_emails(self):
|
||||||
|
pass # @@@ should this just be done centrally?
|
||||||
|
|
||||||
|
|
||||||
BENEFIT_TYPE_CHOICES = [
|
BENEFIT_TYPE_CHOICES = [
|
||||||
("text", "Text"),
|
("text", "Text"),
|
||||||
|
|
22
symposion_project/templates/_default_sidebar.html
Normal file
22
symposion_project/templates/_default_sidebar.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% load sponsorship_tags %}
|
||||||
|
{% load thumbnail %}
|
||||||
|
|
||||||
|
{% sponsor_levels as levels %}
|
||||||
|
|
||||||
|
<h2>Sponsors</h2>
|
||||||
|
|
||||||
|
<div class="sponsor-list">
|
||||||
|
{% for level in levels %}
|
||||||
|
{% if level.sponsors %}
|
||||||
|
<h3 style="margin-top: 3em;">{{ level.name }}</h3>
|
||||||
|
|
||||||
|
{% for sponsor in level.sponsors %}
|
||||||
|
<div style="margin: 10px 0;">
|
||||||
|
<a href="{{ sponsor.external_url }}">
|
||||||
|
<img src="{% thumbnail sponsor.website_logo '100x60' %}" alt="{{ sponsor.name }}" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
|
@ -81,7 +81,7 @@
|
||||||
<section id="dashboard_sponsorship" class="dashboard-section well">
|
<section id="dashboard_sponsorship" class="dashboard-section well">
|
||||||
<h3>{% trans "Sponsorship" %}</h3>
|
<h3>{% trans "Sponsorship" %}</h3>
|
||||||
{% if not user.sponsorships.exists %}
|
{% if not user.sponsorships.exists %}
|
||||||
<a href="{# {% url sponsor_apply %} #}" class="btn">
|
<a href="{% url sponsor_apply %}" class="btn">
|
||||||
Apply to be a sponsor
|
Apply to be a sponsor
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
{% for sponsorship in user.sponsorships.all %}
|
{% for sponsorship in user.sponsorships.all %}
|
||||||
<li>
|
<li>
|
||||||
{% if sponsorship.active %}
|
{% if sponsorship.active %}
|
||||||
<a href="{# {% url sponsor_detail sponsorship.pk %}" #}><b>{{ sponsorship.name }}</b></a>
|
<a href="{% url sponsor_detail sponsorship.pk %}"><b>{{ sponsorship.name }}</b></a>
|
||||||
({{ sponsorship.level }})
|
({{ sponsorship.level }})
|
||||||
{% else %}
|
{% else %}
|
||||||
<b>{{ sponsorship.name }}</b>
|
<b>{{ sponsorship.name }}</b>
|
||||||
|
|
|
@ -66,20 +66,19 @@
|
||||||
{# {% sitetree_breadcrumbs from "main" %} #}
|
{# {% sitetree_breadcrumbs from "main" %} #}
|
||||||
{# {% endblock %} #}
|
{# {% endblock %} #}
|
||||||
|
|
||||||
|
{% block body_outer %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<h4>Sponsors</h4>
|
{% block sidebar %}
|
||||||
<img src="http://placekitten.com/g/200/100"></img><br /><br />
|
{% include "_default_sidebar.html" %}
|
||||||
<img src="http://placekitten.com/g/200/101"></img><br /><br />
|
{% endblock %}
|
||||||
<img src="http://placekitten.com/g/200/98"></img><br /><br />
|
|
||||||
<img src="http://placekitten.com/g/200/99"></img><br /><br />
|
|
||||||
<img src="http://placekitten.com/g/200/102"></img><br /><br />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
28
symposion_project/templates/sponsorship/apply.html
Normal file
28
symposion_project/templates/sponsorship/apply.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{% extends "site_base.html" %}
|
||||||
|
|
||||||
|
{% load bootstrap_tags %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load boxes_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% trans "Apply to be a Sponsor" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block body_class %}sponsors{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
{% box "sponsorship-apply" %}
|
||||||
|
|
||||||
|
<form method="POST" action="" class="form-horizontal">
|
||||||
|
{% csrf_token %}
|
||||||
|
<legend>{% trans "Apply to Be a Sponsor" %}</legend>
|
||||||
|
{{ form|as_bootstrap }}
|
||||||
|
<div class="form-actions">
|
||||||
|
<input class="btn btn-primary" type="submit" value="Apply" />
|
||||||
|
<a class="btn" href="{% url dashboard %}">Cancel</a>
|
||||||
|
<p class="help-block">
|
||||||
|
<small>By submitting this sponsor application you are agreeing to the <a href="{% url cms_page "sponsor/terms/" %}" target="_blank">terms and conditions</a>.</small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
40
symposion_project/templates/sponsorship/detail.html
Normal file
40
symposion_project/templates/sponsorship/detail.html
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{% extends "site_base.html" %}
|
||||||
|
|
||||||
|
{% load bootstrap_tags %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{{ sponsor }}{% endblock %}
|
||||||
|
|
||||||
|
{% block page_title %}{% trans "Sponsorship" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h2>{{ sponsor.name }} ({{ sponsor.level }})</h2>
|
||||||
|
|
||||||
|
<form enctype="multipart/form-data" method="POST" action="" class="form-horizontal">
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset>
|
||||||
|
{{ form|as_bootstrap }}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<h3>{{ sponsor.level }} Sponsor Benefits</h3>
|
||||||
|
|
||||||
|
{{ formset.management_form }}
|
||||||
|
{{ formset.non_form_errors }}
|
||||||
|
|
||||||
|
{% for form in formset.forms %}
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ form.instance.benefit }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
{{ form }}
|
||||||
|
<p class="help-block">{{ form.instance.benefit.description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<input class="btn btn-primary" type="submit" value="Save" />
|
||||||
|
<a class="btn" href="{% url dashboard %}">Cancel</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
43
symposion_project/templates/sponsorship/list.html
Normal file
43
symposion_project/templates/sponsorship/list.html
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{% extends "site_base.html" %}
|
||||||
|
|
||||||
|
{% load sponsorship_tags %}
|
||||||
|
{% load thumbnail %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% trans "About Our Sponsors" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block body_class %}sponsors{% endblock %}
|
||||||
|
|
||||||
|
{% sponsor_levels as levels %}
|
||||||
|
|
||||||
|
{% block body_outer %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="span12">
|
||||||
|
<h1>{% trans "About Our Sponsors" %}</h1>
|
||||||
|
<a href="{% url cms_page "sponsors/prospectus/" %}" class="btn">Learn how to become a sponsor <span class="arrow"></span></a>
|
||||||
|
|
||||||
|
{% for level in levels %}
|
||||||
|
<h3>{{ level.name }}</h3>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{% for sponsor in level.sponsors %}
|
||||||
|
<div class="span4">
|
||||||
|
<div class="sponsor" id="sponsor-{{ sponsor.id }}">
|
||||||
|
<div class="sponsor-content">
|
||||||
|
<h2>
|
||||||
|
<a href="{{ sponsor.external_url }}">
|
||||||
|
<img src="{% thumbnail sponsor.website_logo '150x80' %}" alt="{{ sponsor.name }}" />
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
<h5>{{ sponsor.name }}</h5>
|
||||||
|
<p><a href="{{ sponsor.external_url }}">{{ sponsor.external_url }}</a></p>
|
||||||
|
<p>{{ sponsor.listing_text|urlize|linebreaks }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -23,6 +23,7 @@ urlpatterns = patterns("",
|
||||||
url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
|
url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
|
||||||
url(r"^speaker/", include("symposion.speakers.urls")),
|
url(r"^speaker/", include("symposion.speakers.urls")),
|
||||||
url(r"^proposals/", include("symposion.proposals.urls")),
|
url(r"^proposals/", include("symposion.proposals.urls")),
|
||||||
|
url(r"^sponsors/", include("symposion.sponsorship.urls")),
|
||||||
url(r"^boxes/", include("symposion.boxes.urls")),
|
url(r"^boxes/", include("symposion.boxes.urls")),
|
||||||
url(r"^markitup/", include("markitup.urls")),
|
url(r"^markitup/", include("markitup.urls")),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue