1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Automatically select all members of the 'payed for' field when adding a bill.

This commit is contained in:
Frédéric Sureau 2011-08-10 10:48:14 +02:00
parent 7ee2e74969
commit af2ca220a7

View file

@ -6,9 +6,14 @@ from forms import BillForm
def get_billform_for(project):
"""Return an instance of BillForm configured for a particular project."""
payers = []
ids = []
for m in project.active_members:
payers.append( (str(m.id), m.name) )
ids.append( str(m.id) )
form = BillForm()
payers = [(str(m.id), m.name) for m in project.active_members]
form.payed_for.choices = form.payer.choices = payers
form.payed_for.data = ids
return form
def requires_auth(f):