Commit 10f5dee1 authored by Guillaume Mella's avatar Guillaume Mella
Browse files

add basic csv export so we can curl it

parent a56b9075
Pipeline #27196 skipped with stage
......@@ -8,3 +8,4 @@ def includeme(config):
config.add_route('jmdc_catalog', '/')
config.add_route('jmdc_doc', '/doc')
config.add_route('jmdc_about', '/about')
config.add_route('jmdc_export_csv', '/export_csv')
......@@ -53,4 +53,7 @@
<a href="./export_csv" title="export as csv" target="_blank"><button>Export all as CSV</button></a>
{% endblock content %}
id1,id2,ud_diam,ld_diam,e_ld_diam,band,mu_lambda,method,band_code,notes,bibcode,com{% for star in stars %}{% if star.star_info_entry.0.validated%}{{star.id1}},{{star.id2}},{{star.ud_diam}},{{star.ld_diam}},{{star.e_ld_diam}},{{}},{{star.mu_lambda}},{{star.method}},{{star.band_code}},"{{star.notes}}",{{star.bibcode}},"{{}}"{% endif %}
{% endfor %}
from pyramid.response import Response
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
from jmdc_app.models.star_info import StarInfo
@view_config(route_name='jmdc_export_csv', renderer='../templates/jmdc_export_csv.jinja2')
def jmdc_export_csv(request):
session = request.dbsession
stars = session.query(StarInfo).all()
return { 'stars': stars }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment