Bulk actions on the contribution list view


#1

Hi,

If I am looking at the list of contributions of an event (URL: {event}/manage/contributions ), is it possible to carry out bulk actions on selected abstracts such as assigning them into particular sessions, tracks, or modify the duration?

Thanks!


#2

Thanks to @kolodzie 's reply to Number of reviews by each reviewer and with some trial and error, I have now figured out how to select the contributions I want via Indico shell. Not being much good with Python, I can’t figure out how to carry out a change on the contributions listed.

Contribution.query.filter(Contribution.type_id == <id of the contribution type>).all()

I can see that there is a “duration” option in the API for Contributions but I can’t figure out how to see it and set it using Indico shell.

Thanks,
Ying


#3

Hey,

assuming that contributions holds the result of the aforementioned expression, it is enough to run the following code to e.g. modify duration of all selected contributions:

from datetime import timedelta

for contribution in contributions:
    contribution.duration = timedelta(hours=1)

db.session.commit()

#4

Brilliant, thanks!!!


#5

To answer my own question in full in case it is useful to someone else:

Make a list of a particular type of contributions:

invitedtalks = Contribution.query.filter(Contribution.type_id == <id of contribution type>).all()

To see the duration of the contributions

for talk in invitedtalks:
    print(talk, str(talk.duration))

To change it and see the change after it has been applied

from datetime import timedelta

for talk in invitedtalks:
    talk.duration = timedelta(minutes=30)
    print(talk, str(talk.duration))

To commit to the database

db.session.commit()