-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add a way for sponsors to pay without asking for logos etc. #2503
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
Changes from 5 commits
11d2a24
047bfa6
fe9577e
333371e
f66aeb3
06ac20c
12a8b82
ed21473
6c8ae7c
4bbeec4
ddd7908
8a2db05
3235fe2
4d35ce9
69461a6
0384faf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load i18n %} | ||
{% load static %} | ||
|
||
{% block title %}{% trans "Promo Detail" %}{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<h1> Promo Results </h1> | ||
|
||
{% for promo in promos %} | ||
|
||
<h3> | ||
Results for {{ promo.name }} ({{ promo.analytics_id }}) over last {{ days }} days. | ||
</h3> | ||
|
||
<div class="example" style="width: 30%;"> | ||
<a href="{{ promo.link }}"><img width=120 height=90 src="{{ promo.image }}"></a> | ||
<br> | ||
{{ promo.text }} | ||
|
||
</div> | ||
|
||
<br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whitespace shouldn't be added with html elements, this should be a css change. |
||
|
||
<table> | ||
<tr> | ||
<th><strong>Day (UTC)</strong></th> | ||
<th><strong>Views</strong></th> | ||
<th><strong>Clicks</strong></th> | ||
<th><strong>CTR</strong></th> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
</tr> | ||
{% for day in promo.impressions.all|slice:days_slice %} | ||
<tr> | ||
<td>{{ day.date }}</td> | ||
<td><code>{{ day.views }}</code></td> | ||
<td><code>{{ day.clicks }}</code></td> | ||
<td><code>{{ day.click_ratio }}%</code></td> | ||
</tr> | ||
{% endfor %} | ||
<tr> | ||
<td><strong>Total (over all time)</strong> </td> | ||
<td><strong>{{ promo.total_views }}</strong></td> | ||
<td><strong>{{ promo.total_clicks }}</strong></td> | ||
<td><strong>{{ promo.total_click_ratio }}%</strong></td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for styling here. This should perhaps be a rule for |
||
</tr> | ||
</table> | ||
|
||
{% endfor %} | ||
|
||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
|
||
class PayAdsView(StripeMixin, CreateView): | ||
|
||
"""Create a donation locally and in Stripe""" | ||
"""Create a payment locally and in Stripe""" | ||
|
||
form_class = EthicalAdForm | ||
success_message = _('Your payment has been received') | ||
|
@@ -77,6 +77,26 @@ def get_template_names(self): | |
return [self.template_name] | ||
|
||
|
||
class PromoDetailView(TemplateView): | ||
template_name = 'donate/promo_detail.html' | ||
|
||
def get_context_data(self, **kwargs): | ||
promo_slug = kwargs['promo_slug'] | ||
slugs = promo_slug.split(',') | ||
days = int(self.request.GET.get('days', 90)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Input isn't sanitized here, this should be wrapped for exception handling on |
||
|
||
if promo_slug == 'live' and self.request.user.is_staff: | ||
promos = SupporterPromo.objects.filter(live=True) | ||
else: | ||
promos = SupporterPromo.objects.filter(analytics_id__in=slugs) | ||
|
||
return { | ||
'promos': promos, | ||
'days': days, | ||
'days_slice': ':%s' % days, | ||
} | ||
|
||
|
||
def click_proxy(request, promo_id, hash): | ||
promo = get_object_or_404(SupporterPromo, pk=promo_id) | ||
count = cache.get(promo.cache_key(type=CLICKS, hash=hash), None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with the title and this paragraph block. Framing this as sponsorship is misleading.