Notifications around teams and users.
parent
801a030d32
commit
e5c887c2fc
|
@ -4,6 +4,7 @@ import stripe
|
||||||
from annoying.decorators import ajax_request, render_to
|
from annoying.decorators import ajax_request, render_to
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.core.mail import send_mail
|
||||||
from snipts.models import Snipt
|
from snipts.models import Snipt
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +31,15 @@ def cancel_subscription(request):
|
||||||
profile.stripe_id = None
|
profile.stripe_id = None
|
||||||
profile.save()
|
profile.save()
|
||||||
|
|
||||||
|
send_mail('[Snipt] User cancelled Pro: {}'.format(request.user.username),
|
||||||
|
"""
|
||||||
|
User: https://snipt.net/{}
|
||||||
|
Email: {}
|
||||||
|
""".format(request.user.username, request.user.email),
|
||||||
|
'support@snipt.net',
|
||||||
|
['nick@snipt.net'],
|
||||||
|
fail_silently=False)
|
||||||
|
|
||||||
return {'deleted': True}
|
return {'deleted': True}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -872,22 +872,6 @@
|
||||||
$document.bind('keydown', 'esc', function() {
|
$document.bind('keydown', 'esc', function() {
|
||||||
that.escapeUI();
|
that.escapeUI();
|
||||||
});
|
});
|
||||||
$document.bind('keydown', 'g', function() {
|
|
||||||
if (!window.ui_halted) {
|
|
||||||
if (window.$selected) {
|
|
||||||
window.$selected.trigger('deselect');
|
|
||||||
}
|
|
||||||
window.scrollTo(0, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$document.bind('keydown', 'Shift+g', function() {
|
|
||||||
if (!window.ui_halted) {
|
|
||||||
if (window.$selected) {
|
|
||||||
window.$selected.trigger('deselect');
|
|
||||||
}
|
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$document.bind('keydown', 'n', function() {
|
$document.bind('keydown', 'n', function() {
|
||||||
if (!window.ui_halted) {
|
if (!window.ui_halted) {
|
||||||
var $anc = $('li.next a');
|
var $anc = $('li.next a');
|
||||||
|
|
|
@ -6,6 +6,7 @@ from annoying.decorators import render_to
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
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.core.mail import send_mail
|
||||||
from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest
|
from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from teams.models import Team
|
from teams.models import Team
|
||||||
|
@ -55,6 +56,16 @@ def for_teams_complete(request):
|
||||||
team.user = user
|
team.user = user
|
||||||
team.save()
|
team.save()
|
||||||
|
|
||||||
|
send_mail('[Snipt] New team signup: {}'.format(team.name),
|
||||||
|
"""
|
||||||
|
Team: https://snipt.net/{}
|
||||||
|
Email: {}
|
||||||
|
Plan: {}
|
||||||
|
""".format(team.slug, team.email, team.plan),
|
||||||
|
'support@snipt.net',
|
||||||
|
['nick@snipt.net'],
|
||||||
|
fail_silently=False)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'team': team
|
'team': team
|
||||||
}
|
}
|
||||||
|
@ -155,4 +166,13 @@ def cancel_team_subscription(request, username):
|
||||||
team.plan = None
|
team.plan = None
|
||||||
team.save()
|
team.save()
|
||||||
|
|
||||||
|
send_mail('[Snipt] Team cancelled plan: {}'.format(team.name),
|
||||||
|
"""
|
||||||
|
Team: https://snipt.net/{}
|
||||||
|
Email: {}
|
||||||
|
""".format(team.slug, team.email),
|
||||||
|
'support@snipt.net',
|
||||||
|
['nick@snipt.net'],
|
||||||
|
fail_silently=False)
|
||||||
|
|
||||||
return HttpResponseRedirect('/' + team.slug + '/?team-cancelled=true')
|
return HttpResponseRedirect('/' + team.slug + '/?team-cancelled=true')
|
||||||
|
|
|
@ -364,14 +364,6 @@
|
||||||
<td>p</td>
|
<td>p</td>
|
||||||
<td>Previous page</td>
|
<td>Previous page</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>g</td>
|
|
||||||
<td>Scroll to top of page</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>G</td>
|
|
||||||
<td>Scroll to bottom of page</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
11
views.py
11
views.py
|
@ -9,6 +9,7 @@ from blogs.views import blog_list
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
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.core.mail import send_mail
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.http import HttpResponseRedirect, HttpResponseBadRequest
|
from django.http import HttpResponseRedirect, HttpResponseBadRequest
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
|
@ -117,6 +118,16 @@ def pro_complete(request):
|
||||||
profile.stripe_id = customer.id
|
profile.stripe_id = customer.id
|
||||||
profile.save()
|
profile.save()
|
||||||
|
|
||||||
|
send_mail('[Snipt] New Pro signup: {}'.format(request.user.username),
|
||||||
|
"""
|
||||||
|
User: https://snipt.net/{}
|
||||||
|
Email: {}
|
||||||
|
Plan: {}
|
||||||
|
""".format(request.user.username, request.user.email, plan),
|
||||||
|
'support@snipt.net',
|
||||||
|
['nick@snipt.net'],
|
||||||
|
fail_silently=False)
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue