jmdc_export_csv.py 604 Bytes
Newer Older
1
2
3
from pyramid.view import view_config

from jmdc_app.models.star_info import StarInfo
4
from jmdc_app.models.submission import StarInfoEntry
5
6
7
8
9

@view_config(route_name='jmdc_export_csv', renderer='../templates/jmdc_export_csv.jinja2')
def jmdc_export_csv(request):

    session = request.dbsession
Guillaume Mella's avatar
Guillaume Mella committed
10
    request.response.content_type = 'text/plain'
11

12
13
14
    # order by id (creation order  / look during import ) and check for validated ones
    stars = session.query(StarInfo).filter(StarInfo.star_info_entry.any(StarInfoEntry.validated == True)).order_by(
        StarInfo.id).all()
15
16

    return { 'stars': stars }