GCal Coupling: Management Site - decoupled Email from profile
This commit is contained in:
@@ -4,6 +4,8 @@ from django.http import HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from pprint import pformat
|
||||
from eventplanner_gcal.google_sync import checkIfGoogleCallbackIsValid
|
||||
from eventplanner_gcal.models import UserGCalCoupling
|
||||
from django.shortcuts import render
|
||||
|
||||
import logging
|
||||
|
||||
@@ -14,6 +16,29 @@ def runSync( request ):
|
||||
syncFromLocalToGoogle()
|
||||
return redirect("/")
|
||||
|
||||
|
||||
def manage( request ):
|
||||
|
||||
if request.method == 'POST':
|
||||
if request.POST['activate'] == "1":
|
||||
UserGCalCoupling.objects.filter( user=request.user ).delete()
|
||||
c = UserGCalCoupling( user=request.user, email = request.POST['email'] )
|
||||
c.save()
|
||||
syncFromLocalToGoogle()
|
||||
else:
|
||||
UserGCalCoupling.objects.filter( user=request.user ).delete()
|
||||
syncFromLocalToGoogle()
|
||||
|
||||
context = {}
|
||||
userCoupling = UserGCalCoupling.objects.filter( user = request.user )
|
||||
context['enabled'] = len(userCoupling)
|
||||
assert( len(userCoupling) < 2 )
|
||||
if len(userCoupling) == 1:
|
||||
context['mail'] = userCoupling[0].email
|
||||
|
||||
return render( request, 'eventplanner_gcal/management.html', context )
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
def gcalApiCallback( request ):
|
||||
# TODO check channel info here
|
||||
|
||||
Reference in New Issue
Block a user