adding opt in to social media
This commit is contained in:
@@ -2973,6 +2973,9 @@ class VirtualRaceResult(models.Model):
|
|||||||
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
||||||
verbose_name='Group')
|
verbose_name='Group')
|
||||||
|
|
||||||
|
acceptsocialmedia = models.BooleanField(default=True,
|
||||||
|
verbose_name = 'I agree with sharing my name in challenge related social media posts (unchecking this does not prevent you from participation)')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
name = '{u1} {u2}'.format(
|
name = '{u1} {u2}'.format(
|
||||||
@@ -3048,6 +3051,8 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
verbose_name = 'Receive challenge notifications by email')
|
verbose_name = 'Receive challenge notifications by email')
|
||||||
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
|
||||||
verbose_name='Group')
|
verbose_name='Group')
|
||||||
|
acceptsocialmedia = models.BooleanField(default=True,
|
||||||
|
verbose_name = 'I agree with sharing my name in challenge related social media posts (unchecking this does not prevent you from participation)')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -3097,7 +3102,7 @@ class IndoorVirtualRaceResultForm(ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = IndoorVirtualRaceResult
|
model = IndoorVirtualRaceResult
|
||||||
fields = ['teamname','weightcategory','boatclass','age','adaptiveclass',
|
fields = ['teamname','weightcategory','boatclass','age','adaptiveclass',
|
||||||
'entrycategory'
|
'entrycategory','acceptsocialmedia'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -3115,7 +3120,7 @@ class VirtualRaceResultForm(ModelForm):
|
|||||||
model = VirtualRaceResult
|
model = VirtualRaceResult
|
||||||
fields = ['teamname','weightcategory','boatclass','boattype',
|
fields = ['teamname','weightcategory','boatclass','boattype',
|
||||||
'age','adaptiveclass',
|
'age','adaptiveclass',
|
||||||
'entrycategory'
|
'entrycategory','acceptsocialmedia'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1116,6 +1116,38 @@ def handle_sendemail_raceregistration(
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
@app.task
|
||||||
|
def handle_sendemail_optout(
|
||||||
|
useremail, username, registeredname, racename, raceid, **kwargs):
|
||||||
|
|
||||||
|
if 'debug' in kwargs:
|
||||||
|
debug = kwargs['debug']
|
||||||
|
else:
|
||||||
|
debug = True
|
||||||
|
|
||||||
|
subject = "{name} has opted out from social media posts around challenge {n}".format(
|
||||||
|
n = racename,
|
||||||
|
name = registeredname
|
||||||
|
)
|
||||||
|
|
||||||
|
from_email = 'Rowsandall <info@rowsandall.com>'
|
||||||
|
|
||||||
|
d = {
|
||||||
|
'username':username,
|
||||||
|
'registeredname':registeredname,
|
||||||
|
'siteurl':siteurl,
|
||||||
|
'racename':racename,
|
||||||
|
'raceid':raceid,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = send_template_email(from_email,[useremail],
|
||||||
|
subject,
|
||||||
|
'raceoptoutsocialmedia.html',
|
||||||
|
d,**kwargs)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
def handle_sendemail_racesubmission(
|
def handle_sendemail_racesubmission(
|
||||||
useremail, username, registeredname, racename, raceid, **kwargs):
|
useremail, username, registeredname, racename, raceid, **kwargs):
|
||||||
|
|||||||
24
rowers/templates/raceoptoutsocialmedia.html
Normal file
24
rowers/templates/raceoptoutsocialmedia.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends "emailbase.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<p>Dear <strong>{{ username }}</strong>,</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ registeredname }} has opted out from Social Media posts regarding the
|
||||||
|
virtual challenge {{ racename }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If you are making any posts to Social Media about the event, you have to
|
||||||
|
do this without mentioning their name.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
As the organizer of the virtual challenge it is your responsibility to
|
||||||
|
respect this. Rowsandall.com is not responsible for any damage caused.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Best Regards, the Rowsandall Team
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -35,6 +35,11 @@
|
|||||||
as a Male crew. Check the "Mixed gender" check box to register as a
|
as a Male crew. Check the "Mixed gender" check box to register as a
|
||||||
mixed gender crew (except for 1x where this check box does nothing).
|
mixed gender crew (except for 1x where this check box does nothing).
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
The challenge organizer may want to publish about the challenge on social media and
|
||||||
|
use your name in the results. If you do not want your name to appear on social media,
|
||||||
|
you can let this know by unchecking the check box in the form.
|
||||||
|
</p>
|
||||||
{% if race.coursestandards %}
|
{% if race.coursestandards %}
|
||||||
<p>This race uses standard times and limits the race groups to those where
|
<p>This race uses standard times and limits the race groups to those where
|
||||||
standard times exist. The "Group" form choice will overrule other selections you
|
standard times exist. The "Group" form choice will overrule other selections you
|
||||||
@@ -52,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input class="button green" type="submit" value="Submit">
|
<input class="button" type="submit" value="Submit">
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1518,6 +1518,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
adaptiveclass = cd['adaptiveclass']
|
adaptiveclass = cd['adaptiveclass']
|
||||||
age = cd['age']
|
age = cd['age']
|
||||||
mix = cd['mix']
|
mix = cd['mix']
|
||||||
|
acceptsocialmedia = cd['acceptsocialmedia']
|
||||||
|
|
||||||
sex = r.sex
|
sex = r.sex
|
||||||
if mix:
|
if mix:
|
||||||
@@ -1612,12 +1613,22 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
entrycategory=coursestandard,
|
entrycategory=coursestandard,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
|
acceptsocialmedia=acceptsocialmedia,
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
add_rower_race(r,race)
|
add_rower_race(r,race)
|
||||||
|
|
||||||
|
# send email about opt out
|
||||||
|
if not acceptsocialmedia:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_optout,
|
||||||
|
race.manager.email,race.manager.first_name,
|
||||||
|
r.user.first_name+' '+r.user.last_name,
|
||||||
|
race.name,race.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
messages.info(
|
messages.info(
|
||||||
@@ -1767,6 +1778,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
adaptiveclass = cd['adaptiveclass']
|
adaptiveclass = cd['adaptiveclass']
|
||||||
age = cd['age']
|
age = cd['age']
|
||||||
mix = cd['mix']
|
mix = cd['mix']
|
||||||
|
acceptsocialmedia = cd['acceptsocialmedia']
|
||||||
|
|
||||||
sex = r.sex
|
sex = r.sex
|
||||||
if mix:
|
if mix:
|
||||||
@@ -1829,13 +1841,23 @@ def virtualevent_register_view(request,id=0):
|
|||||||
coursecompleted=False,
|
coursecompleted=False,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
entrycategory=coursestandard,
|
entrycategory=coursestandard,
|
||||||
referencespeed=referencespeed,
|
referencespeed=referencespeed,
|
||||||
|
acceptsocialmedia = acceptsocialmedia,
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
add_rower_race(r,race)
|
add_rower_race(r,race)
|
||||||
|
# send email about opt out
|
||||||
|
if not acceptsocialmedia:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_optout,
|
||||||
|
race.manager.email,race.manager.first_name,
|
||||||
|
r.user.first_name+' '+r.user.last_name,
|
||||||
|
race.name,race.id,
|
||||||
|
)
|
||||||
|
|
||||||
# remove followers
|
# remove followers
|
||||||
myfollows = VirtualRaceFollower.objects.filter(user=r.user,race=race)
|
myfollows = VirtualRaceFollower.objects.filter(user=r.user,race=race)
|
||||||
@@ -2028,6 +2050,7 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
adaptiveclass = cd['adaptiveclass']
|
adaptiveclass = cd['adaptiveclass']
|
||||||
age = cd['age']
|
age = cd['age']
|
||||||
boatclass = cd['boatclass']
|
boatclass = cd['boatclass']
|
||||||
|
acceptsocialmedia = cd['acceptsocialmedia']
|
||||||
|
|
||||||
sex = r.sex
|
sex = r.sex
|
||||||
|
|
||||||
@@ -2086,13 +2109,24 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
sex=sex,
|
sex=sex,
|
||||||
age=age,
|
age=age,
|
||||||
entrycategory=coursestandard,
|
entrycategory=coursestandard,
|
||||||
referencespeed=referencespeed
|
referencespeed=referencespeed,
|
||||||
|
acceptsocialmedia=acceptsocialmedia,
|
||||||
)
|
)
|
||||||
|
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
add_rower_race(r,race)
|
add_rower_race(r,race)
|
||||||
|
|
||||||
|
# send email about opt out
|
||||||
|
if not acceptsocialmedia:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_optout,
|
||||||
|
race.manager.email,race.manager.first_name,
|
||||||
|
r.user.first_name+' '+r.user.last_name,
|
||||||
|
race.name,race.id,
|
||||||
|
)
|
||||||
|
|
||||||
# remove followers
|
# remove followers
|
||||||
myfollows = VirtualRaceFollower.objects.filter(user=r.user,race=race)
|
myfollows = VirtualRaceFollower.objects.filter(user=r.user,race=race)
|
||||||
for f in myfollows:
|
for f in myfollows:
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ from rowers.tasks import (
|
|||||||
handle_sendemail_userdeleted,
|
handle_sendemail_userdeleted,
|
||||||
handle_sendemail_raceregistration,
|
handle_sendemail_raceregistration,
|
||||||
handle_sendemail_racesubmission,
|
handle_sendemail_racesubmission,
|
||||||
|
handle_sendemail_optout,
|
||||||
handle_sendemail_ical,
|
handle_sendemail_ical,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user