Ejemplo n.º 1
0
def generate_prereg_csv():
    drafts = map(serializers.serialize_draft_registration,
                   utils.get_submitted_preregistrations())

    keys = drafts[0].keys()
    keys.remove('registration_schema')
    output = io.BytesIO()
    writer = csv.DictWriter(output, fieldnames=keys)
    writer.writeheader()
    for draft in drafts:
        draft.pop('registration_schema')
        draft.update({'initiator': draft['initiator']['username']})
        writer.writerow(
            {k: v.encode('utf8') if isinstance(v, unicode) else v
             for k, v in draft.items()}
        )
    return output
def generate_prereg_csv():
    drafts = map(serializers.serialize_draft_registration,
                 utils.get_submitted_preregistrations())

    keys = drafts[0].keys()
    keys.remove('registration_schema')
    output = io.BytesIO()
    writer = csv.DictWriter(output, fieldnames=keys)
    writer.writeheader()
    for draft in drafts:
        draft.pop('registration_schema')
        draft.update({'initiator': draft['initiator']['username']})
        writer.writerow({
            k: v.encode('utf8') if isinstance(v, unicode) else v
            for k, v in draft.items()
        })
    return output
Ejemplo n.º 3
0
 def get_queryset(self):
     return utils.get_submitted_preregistrations(self.get_ordering())