Very basic CSV "export"
This commit is contained in:
parent
0edcaeb11e
commit
0cdee23b30
|
@ -39,4 +39,9 @@
|
|||
|
||||
</table>
|
||||
|
||||
<h4>CSV</h4>
|
||||
<textarea rows=10 cols=100>
|
||||
{{ csv }}
|
||||
</textarea>
|
||||
|
||||
{% endblock %}
|
||||
|
|
3
src/program/templates/control/proposal_overview.csv
Normal file
3
src/program/templates/control/proposal_overview.csv
Normal file
|
@ -0,0 +1,3 @@
|
|||
title,submitter email,status,instances,video recording
|
||||
{% for proposal in proposals %}{{ proposal.title }},{{ proposal.user.email }},{{ proposal.proposal_status }},{% for instance in proposal.event.instances.all %}When: {{ instance.when.lower|date:"l d. b H:i" }} - {{ instance.when.upper|date:"H:i" }} Where: {{ instance.location.name }}{% endfor %},{{ proposal.event.video_recording }}
|
||||
{% endfor %}
|
Can't render this file because it contains an unexpected character in line 2 and column 194.
|
|
@ -13,6 +13,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||
from django.contrib import messages
|
||||
from django.urls import reverse
|
||||
from django.db.models import Q
|
||||
from django.template import Engine, Context
|
||||
|
||||
import icalendar
|
||||
|
||||
|
@ -323,5 +324,10 @@ class ProgramControlCenter(CampViewMixin, TemplateView):
|
|||
camp=self.camp
|
||||
).select_related('user', 'event')
|
||||
context['proposals'] = proposals
|
||||
return context
|
||||
|
||||
engine = Engine.get_default()
|
||||
template = engine.get_template('control/proposal_overview.csv')
|
||||
csv = template.render(Context(context))
|
||||
context['csv'] = csv
|
||||
|
||||
return context
|
||||
|
|
Loading…
Reference in a new issue