ics is now download file
This commit is contained in:
@@ -103,6 +103,7 @@ import rowers.uploads as uploads
|
|||||||
from django.forms.formsets import formset_factory
|
from django.forms.formsets import formset_factory
|
||||||
from django.forms import modelformset_factory
|
from django.forms import modelformset_factory
|
||||||
import StringIO
|
import StringIO
|
||||||
|
import cStringIO
|
||||||
from django.contrib.auth.decorators import login_required #,user_passes_test
|
from django.contrib.auth.decorators import login_required #,user_passes_test
|
||||||
from rowers.decorators import user_passes_test
|
from rowers.decorators import user_passes_test
|
||||||
from time import strftime,strptime,mktime,time,daylight
|
from time import strftime,strptime,mktime,time,daylight
|
||||||
@@ -1457,31 +1458,9 @@ def plannedsessions_icsemail_view(request,userid=0):
|
|||||||
event.add('comment',comment)
|
event.add('comment',comment)
|
||||||
cal.add_component(event)
|
cal.add_component(event)
|
||||||
|
|
||||||
icsfilename = 'calendar_{id}.ics'.format(id=request.user.id)
|
|
||||||
|
|
||||||
with open(icsfilename,'wb') as f:
|
|
||||||
f.write(cal.to_ical())
|
|
||||||
|
|
||||||
res = myqueue(queuehigh,handle_sendemailics,
|
response = HttpResponse(cal.to_ical(),content_type = 'text/plain')
|
||||||
request.user.first_name,
|
response['Content-Disposition'] = 'attachment; filename="training_plan_%s.ics"' % request.user.id
|
||||||
request.user.last_name,
|
|
||||||
request.user.email,icsfilename,
|
|
||||||
emailbounced = r.emailbounced
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
successmessage = "The calendar file was sent to you per email"
|
|
||||||
messages.info(request,successmessage)
|
|
||||||
url = reverse(plannedsessions_view,
|
|
||||||
kwargs = {
|
|
||||||
'userid':r.user.id,
|
|
||||||
})
|
|
||||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
|
||||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
|
||||||
url+='?when='+startdatestring+'/'+enddatestring
|
|
||||||
|
|
||||||
|
|
||||||
response = HttpResponseRedirect(url)
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
@@ -289,14 +289,14 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<div class="ad">
|
<ad class="ad">
|
||||||
{% block ad %}
|
{% block ad %}
|
||||||
<a href="https://pryglrowing.com">
|
<a href="https://pryglrowing.com">
|
||||||
<img src="/static/img/prygl.jpg">
|
<img src="/static/img/prygl.jpg">
|
||||||
<p style="text-align: center">Prygl Rowing Camps</p>
|
<p style="text-align: center">Prygl Rowing Camps</p>
|
||||||
</a>
|
</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</ad>
|
||||||
|
|
||||||
<footer class="main-footer">
|
<footer class="main-footer">
|
||||||
<p>Follow us on
|
<p>Follow us on
|
||||||
|
|||||||
Reference in New Issue
Block a user