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

Last selected payer and translations. Fix #47.

- Last selected payer selected by default when creating a new bill

- Fix some translation typos and modify a few labels
This commit is contained in:
Arnaud Bos 2011-10-20 04:18:12 +02:00
parent 440ccb6e22
commit 1e0898dd87
7 changed files with 224 additions and 193 deletions

View file

@ -13,6 +13,13 @@ def select_multi_checkbox(field, ul_class='', **kwargs):
kwargs.setdefault('type', 'checkbox')
field_id = kwargs.pop('id', field.id)
html = [u'<ul %s>' % html_params(id=field_id, class_="inputs-list")]
choice_id = u'toggleField'
js_function = u'toggle();'
options = dict(kwargs, id=choice_id, onclick=js_function)
label = _("Select All/None")
html.append(u'<li><label for="%s">%s<span>%s</span></label></li>' % (choice_id, '<input %s /> ' % html_params(**options), label))
for value, label, checked in field.iter_choices():
choice_id = u'%s-%s' % (field_id, value)
options = dict(kwargs, name=field.name, value=value, id=choice_id)
@ -96,7 +103,7 @@ class BillForm(Form):
what = TextField(_("What?"), validators=[Required()])
payer = SelectField(_("Payer"), validators=[Required()], coerce=int)
amount = DecimalField(_("Amount payed"), validators=[Required()])
payed_for = SelectMultipleField(_("Who has to pay for this?"),
payed_for = SelectMultipleField(_("For whom?"),
validators=[Required()], widget=select_multi_checkbox, coerce=int)
submit = SubmitField(_("Send the bill"))

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2011-10-15 00:42+0200\n"
"POT-Creation-Date: 2011-10-20 02:32+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,31 +17,35 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"
#: forms.py:44
#: forms.py:20
msgid "Select All/None"
msgstr ""
#: forms.py:51
msgid "Project name"
msgstr ""
#: forms.py:45 forms.py:70 forms.py:81
#: forms.py:52 forms.py:77 forms.py:88
msgid "Private code"
msgstr ""
#: forms.py:46
#: forms.py:53
msgid "Email"
msgstr ""
#: forms.py:47
#: forms.py:54
msgid "Edit the project"
msgstr ""
#: forms.py:69 forms.py:80 forms.py:86
#: forms.py:76 forms.py:87 forms.py:93
msgid "Project identifier"
msgstr ""
#: forms.py:71 templates/send_invites.html:5
#: forms.py:78 templates/send_invites.html:5
msgid "Create the project"
msgstr ""
#: forms.py:76
#: forms.py:83
msgid ""
"The project identifier is used to log in and for the URL of the project. "
"We tried to generate an identifier for you but a project with this "
@ -49,143 +53,147 @@ msgid ""
"able to remember."
msgstr ""
#: forms.py:82
#: forms.py:89
msgid "Get in"
msgstr ""
#: forms.py:87
#: forms.py:94
msgid "Send me the code by email"
msgstr ""
#: forms.py:91
#: forms.py:98
msgid "This project does not exists"
msgstr ""
#: forms.py:95
#: forms.py:102
msgid "Date"
msgstr ""
#: forms.py:96
#: forms.py:103
msgid "What?"
msgstr ""
#: forms.py:97
#: forms.py:104
msgid "Payer"
msgstr ""
#: forms.py:98
#: forms.py:105
msgid "Amount payed"
msgstr ""
#: forms.py:99
msgid "Who has to pay for this?"
#: forms.py:106 templates/list_bills.html:89
msgid "For whom?"
msgstr ""
#: forms.py:101
#: forms.py:108
msgid "Send the bill"
msgstr ""
#: forms.py:126
msgid "Name"
msgstr ""
#: forms.py:127
msgid "Add a member"
#: forms.py:132
msgid "Bills can't be negative"
msgstr ""
#: forms.py:137
msgid "This project already have this member"
msgid "Name"
msgstr ""
#: forms.py:147
msgid "People to notify"
#: forms.py:138
msgid "Add a member"
msgstr ""
#: forms.py:148
msgid "Send invites"
msgstr ""
#: forms.py:154
#, python-format
msgid "The email %s is not valid"
msgid "This project already have this member"
msgstr ""
#: forms.py:158
msgid "Start date"
msgid "People to notify"
msgstr ""
#: forms.py:159
msgid "Send invites"
msgstr ""
#: forms.py:165
#, python-format
msgid "The email %(email)s is not valid"
msgstr ""
#: forms.py:170
msgid "Start date"
msgstr ""
#: forms.py:171
msgid "End date"
msgstr ""
#: forms.py:160
#: forms.py:172
msgid "Name for this archive (optional)"
msgstr ""
#: web.py:91
#: web.py:89
msgid "This private code is not the right one"
msgstr ""
#: web.py:139
#: web.py:137
#, python-format
msgid "You have just created '%(projec)s' to share your expenses"
msgid "You have just created '%(project)s' to share your expenses"
msgstr ""
#: web.py:150
#: web.py:148
#, python-format
msgid "The project identifier is %(project)s"
msgstr ""
#: web.py:167
#: web.py:166
msgid "a mail has been sent to you with the password"
msgstr ""
#: web.py:225
#: web.py:224
#, python-format
msgid "You have been invited to share your expenses for %(project)s"
msgstr ""
#: web.py:232
#: web.py:231
msgid "Your invitations have been sent"
msgstr ""
#: web.py:253
#: web.py:252
#, python-format
msgid "%(member)s had been added"
msgstr ""
#: web.py:265
#: web.py:264
#, python-format
msgid "%(name)s is part of this project again"
msgstr ""
#: web.py:273
#: web.py:272
#, python-format
msgid "User '%(name)s' has been deactivated"
msgstr ""
#: web.py:275
#: web.py:274
#, python-format
msgid "User '%(name)s' has been removed"
msgstr ""
#: web.py:288
#: web.py:287
msgid "The bill has been added"
msgstr ""
#: web.py:303
#: web.py:302
msgid "The bill has been deleted"
msgstr ""
#: web.py:321
#: web.py:320
msgid "The bill has been modified"
msgstr ""
#: web.py:338
#: web.py:344
msgid "The data from XX to XX has been archived"
msgstr ""
#: templates/add_bill.html:4 templates/edit_bill.html:4
#: templates/add_bill.html:23 templates/edit_bill.html:23
msgid "Back to the list"
msgstr ""
@ -207,7 +215,7 @@ msgstr ""
msgid "Create a new project"
msgstr ""
#: templates/edit_bill.html:8
#: templates/edit_bill.html:27
msgid "Edit a bill"
msgstr ""
@ -299,107 +307,103 @@ msgstr ""
msgid "Account manager"
msgstr ""
#: templates/layout.html:48
#: templates/layout.html:52
msgid "Bills"
msgstr ""
#: templates/layout.html:49
msgid "Archives"
msgstr ""
#: templates/layout.html:53
#: templates/layout.html:56
msgid "options"
msgstr ""
#: templates/layout.html:55
#: templates/layout.html:58
msgid "Project settings"
msgstr ""
#: templates/layout.html:59
#: templates/layout.html:62
msgid "switch to"
msgstr ""
#: templates/layout.html:62
#: templates/layout.html:65
msgid "Start a new project"
msgstr ""
#: templates/layout.html:64
#: templates/layout.html:67
msgid "Logout"
msgstr ""
#: templates/layout.html:85
#: templates/layout.html:93
msgid "This is a free software"
msgstr ""
#: templates/layout.html:85
#: templates/layout.html:93
msgid "you can contribute and improve it!"
msgstr ""
#: templates/list_bills.html:30
#: templates/list_bills.html:37
msgid "you sure?"
msgstr ""
#: templates/list_bills.html:45
#: templates/list_bills.html:56
msgid "Balance"
msgstr ""
#: templates/list_bills.html:56 templates/list_bills.html:88
#: templates/list_bills.html:67 templates/list_bills.html:99
msgid "delete"
msgstr ""
#: templates/list_bills.html:56
#: templates/list_bills.html:67
msgid "reactivate"
msgstr ""
#: templates/list_bills.html:68
#: templates/list_bills.html:80
msgid "The project identifier is"
msgstr ""
#: templates/list_bills.html:68
msgid "remember it or add this page to you bookmarks!"
#: templates/list_bills.html:80
msgid "remember it!"
msgstr ""
#: templates/list_bills.html:70
#: templates/list_bills.html:81
msgid "Add a new bill"
msgstr ""
#: templates/list_bills.html:72
#: templates/list_bills.html:83
msgid "hide this form"
msgstr ""
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "When?"
msgstr ""
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "Who paid?"
msgstr ""
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "For what?"
msgstr ""
#: templates/list_bills.html:78
msgid "Owers"
msgstr ""
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "How much?"
msgstr ""
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "Actions"
msgstr ""
#: templates/list_bills.html:87
#: templates/list_bills.html:97
msgid "each"
msgstr ""
#: templates/list_bills.html:98
msgid "edit"
msgstr ""
#: templates/list_bills.html:95
#: templates/list_bills.html:106
msgid "Nothing to list yet. You probably want to"
msgstr ""
#: templates/list_bills.html:95
#: templates/list_bills.html:106
msgid "add a bill"
msgstr ""
@ -443,8 +447,3 @@ msgstr ""
msgid "and notify them yourself"
msgstr ""
msgid "each"
msgstr ""
msgid "Bills can't be negative"
msgstr ""

View file

@ -0,0 +1,17 @@
// Add a script to select all or non of the checkboxes in the add_bill form
function toggle()
{
var els = document.getElementsByName('payed_for');
for(var i =0;i<els.length;i++)
{
if(document.getElementById('toggleField').checked)
{
els[i].checked=true;
}
else
{
els[i].checked=false;
}
}
}

View file

@ -6,6 +6,7 @@
{% if g.lang != "en" %}
<script src="{{ url_for("static", filename="jquery/i18n/jquery.ui.datepicker-%s.js" % g.lang ) }}"></script>
{% endif %}
<script src="{{ url_for("static", filename="ihatemoney/custom.js") }}"></script>
{% endblock %}
{% block js %}
// display the form when clicking on the "add bill" button
@ -77,7 +78,7 @@
{% endblock %}
{% block content %}
<div class="identifier">{{ _("The project identifier is") }} <a href="{{ url_for(".list_bills") }}">{{ g.project.id }}</a>, {{ _("remember it or add this page to you bookmarks!") }}</div>
<div class="identifier">{{ _("The project identifier is") }} <a href="{{ url_for(".list_bills") }}">{{ g.project.id }}</a>, {{ _("remember it!") }}</div>
<a id="new-bill" href="{{ url_for(".add_bill") }}" class="primary">{{ _("Add a new bill") }}</a>
<form id="bill-form" action="{{ url_for(".add_bill") }}" method="post" style="display: none">
<a id="hide-bill-form" href="#">{{ _("hide this form") }}</a>
@ -86,7 +87,7 @@
{% if bills.count() > 0 %}
<table class="list_bills common-table zebra-striped">
<thead><tr><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("Owers") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead>
<thead><tr><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead>
<tbody>
{% for bill in bills %}
<tr class="{{ loop.cycle("odd", "even") }}">

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2011-10-15 00:42+0200\n"
"POT-Creation-Date: 2011-10-20 02:32+0200\n"
"PO-Revision-Date: 2011-10-14 23:51+0200\n"
"Last-Translator: Alexis Métaireau <alexis@notmyidea.org>\n"
"Language-Team: fr <LL@li.org>\n"
@ -17,31 +17,35 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"
#: forms.py:44
#: forms.py:20
msgid "Select All/None"
msgstr "Cocher Tous/Aucun"
#: forms.py:51
msgid "Project name"
msgstr "Nom de projet"
#: forms.py:45 forms.py:70 forms.py:81
#: forms.py:52 forms.py:77 forms.py:88
msgid "Private code"
msgstr "Code d'accès"
#: forms.py:46
#: forms.py:53
msgid "Email"
msgstr "Email"
#: forms.py:47
#: forms.py:54
msgid "Edit the project"
msgstr "Éditer le projet"
#: forms.py:69 forms.py:80 forms.py:86
#: forms.py:76 forms.py:87 forms.py:93
msgid "Project identifier"
msgstr "Identifiant de projet"
msgstr "Identifiant du projet"
#: forms.py:71 templates/send_invites.html:5
#: forms.py:78 templates/send_invites.html:5
msgid "Create the project"
msgstr "Créer le projet"
#: forms.py:76
#: forms.py:83
msgid ""
"The project identifier is used to log in and for the URL of the project. "
"We tried to generate an identifier for you but a project with this "
@ -50,146 +54,150 @@ msgid ""
msgstr ""
"L'identifiant de projet est utilisé pour se connecter et dans l'URL du "
"projetNous avons essayé de générer une identifiant pour ce projet mais "
"celui ci existedéjà. Merci de créer un nouvel identifiant que vous serez "
"capable de retenir"
"celui ci existe déjà. Merci de créer un nouvel identifiant que vous serez"
" capable de retenir"
#: forms.py:82
#: forms.py:89
msgid "Get in"
msgstr "Entrer"
#: forms.py:87
#: forms.py:94
msgid "Send me the code by email"
msgstr "Envoyez moi le code par email"
#: forms.py:91
#: forms.py:98
msgid "This project does not exists"
msgstr "Ce projet n'existe pas"
#: forms.py:95
#: forms.py:102
msgid "Date"
msgstr "Date"
#: forms.py:96
#: forms.py:103
msgid "What?"
msgstr "Quoi ?"
#: forms.py:97
#: forms.py:104
msgid "Payer"
msgstr "Payeur"
#: forms.py:98
#: forms.py:105
msgid "Amount payed"
msgstr "Montant"
#: forms.py:99
msgid "Who has to pay for this?"
msgstr "Qui doit payer pour ça ?"
#: forms.py:106 templates/list_bills.html:89
msgid "For whom?"
msgstr "Pour qui ?"
#: forms.py:101
#: forms.py:108
msgid "Send the bill"
msgstr "Enregistrer la facture"
#: forms.py:126
#: forms.py:132
msgid "Bills can't be negative"
msgstr "Le montant d'une facture ne peut pas être négatif"
#: forms.py:137
msgid "Name"
msgstr "Nom"
#: forms.py:127
#: forms.py:138
msgid "Add a member"
msgstr "Ajouter un membre"
#: forms.py:137
#: forms.py:148
msgid "This project already have this member"
msgstr "Ce membre existe déjà pour ce projet"
#: forms.py:147
#: forms.py:158
msgid "People to notify"
msgstr "Personnes à prévenir"
#: forms.py:148
#: forms.py:159
msgid "Send invites"
msgstr "Envoyer les invitations"
#: forms.py:154
#: forms.py:165
#, python-format
msgid "The email %s is not valid"
msgstr "L'email %s est invalide"
msgid "The email %(email)s is not valid"
msgstr "L'email %(email)s est invalide"
#: forms.py:158
#: forms.py:170
msgid "Start date"
msgstr "Date de départ"
#: forms.py:159
#: forms.py:171
msgid "End date"
msgstr "Date de fin"
#: forms.py:160
#: forms.py:172
msgid "Name for this archive (optional)"
msgstr "Nom pour cette archive"
#: web.py:91
#: web.py:89
msgid "This private code is not the right one"
msgstr "Le code que vous avez entré n'est pas correct"
#: web.py:139
#: web.py:137
#, python-format
msgid "You have just created '%(project)s' to share your expenses"
msgstr "Vous venez de créer '%(project)s' pour partager vos dépenses"
#: web.py:150
#: web.py:148
#, python-format
msgid "The project identifier is %(project)s"
msgstr "L'identifiant de ce projet est '%(project)s'"
#: web.py:167
#: web.py:166
msgid "a mail has been sent to you with the password"
msgstr "Un email vous à été envoyé avec le mot de passe"
msgstr "Un email vous a été envoyé avec le mot de passe"
#: web.py:225
#: web.py:224
#, python-format
msgid "You have been invited to share your expenses for %(project)s"
msgstr "Vous avez été invité à partager vos dépenses pour %(project)s"
#: web.py:232
#: web.py:231
msgid "Your invitations have been sent"
msgstr "Vos invitations ont bien été envoyées"
#: web.py:253
#: web.py:252
#, python-format
msgid "%(member)s had been added"
msgstr "%(member)s à bien été ajouté"
msgstr "%(member)s a bien été ajouté"
#: web.py:265
#: web.py:264
#, python-format
msgid "%(name)s is part of this project again"
msgstr "%(name)s à rejoint le projet"
msgstr "%(name)s a rejoint le projet"
#: web.py:273
#: web.py:272
#, python-format
msgid "User '%(name)s' has been deactivated"
msgstr "Le membre '%(name)s' à été désactivé"
msgstr "Le membre '%(name)s' a été désactivé"
#: web.py:275
#: web.py:274
#, python-format
msgid "User '%(name)s' has been removed"
msgstr "Le membre '%(name)s' à été supprimé"
msgstr "Le membre '%(name)s' a été supprimé"
#: web.py:288
#: web.py:287
msgid "The bill has been added"
msgstr "La facture à bien été ajoutée"
msgstr "La facture a bien été ajoutée"
#: web.py:303
#: web.py:302
msgid "The bill has been deleted"
msgstr "La facture à été supprimée"
msgstr "La facture a été supprimée"
#: web.py:321
#: web.py:320
msgid "The bill has been modified"
msgstr "La facture à été modifiée"
msgstr "La facture a été modifiée"
#: web.py:338
#: web.py:344
msgid "The data from XX to XX has been archived"
msgstr "Les données de XX à XX ont été archivées"
#: templates/add_bill.html:4 templates/edit_bill.html:4
#: templates/add_bill.html:23 templates/edit_bill.html:23
msgid "Back to the list"
msgstr "Retourner à la liste"
@ -211,7 +219,7 @@ msgstr " ?"
msgid "Create a new project"
msgstr "Créer un nouveau projet"
#: templates/edit_bill.html:8
#: templates/edit_bill.html:27
msgid "Edit a bill"
msgstr "Éditer une facture"
@ -221,7 +229,7 @@ msgstr "Éditer ce projet"
#: templates/forms.html:24
msgid "Can't remember the password?"
msgstr "Vous ne vous rappelez plus du code d'accès ?"
msgstr "Vous ne vous souvenez plus du code d'accès ?"
#: templates/forms.html:27
msgid "Cancel"
@ -289,7 +297,7 @@ msgstr "se connecter"
#: templates/home.html:29
msgid "can't remember your password?"
msgstr "vous ne vous rappelez plus du code d'accès ?"
msgstr "vous ne vous souvenez plus du code d'accès ?"
#: templates/home.html:34
msgid "or create a new one"
@ -303,107 +311,103 @@ msgstr "c'est parti !"
msgid "Account manager"
msgstr "Gestion de comptes"
#: templates/layout.html:48
#: templates/layout.html:52
msgid "Bills"
msgstr "Factures"
#: templates/layout.html:49
msgid "Archives"
msgstr "Archives"
#: templates/layout.html:53
#: templates/layout.html:56
msgid "options"
msgstr "options"
#: templates/layout.html:55
#: templates/layout.html:58
msgid "Project settings"
msgstr "Options du projet"
#: templates/layout.html:59
#: templates/layout.html:62
msgid "switch to"
msgstr "aller à"
#: templates/layout.html:62
#: templates/layout.html:65
msgid "Start a new project"
msgstr "Nouveau projet"
#: templates/layout.html:64
#: templates/layout.html:67
msgid "Logout"
msgstr "Se déconnecter"
#: templates/layout.html:85
#: templates/layout.html:93
msgid "This is a free software"
msgstr "Ceci est un logiciel libre"
#: templates/layout.html:85
#: templates/layout.html:93
msgid "you can contribute and improve it!"
msgstr "vous pouvez y contribuer et l'améliorer"
#: templates/list_bills.html:30
#: templates/list_bills.html:37
msgid "you sure?"
msgstr "c'est sûr ?"
#: templates/list_bills.html:45
#: templates/list_bills.html:56
msgid "Balance"
msgstr "Balance"
#: templates/list_bills.html:56 templates/list_bills.html:88
#: templates/list_bills.html:67 templates/list_bills.html:99
msgid "delete"
msgstr "supprimer"
#: templates/list_bills.html:56
#: templates/list_bills.html:67
msgid "reactivate"
msgstr "ré-activer"
#: templates/list_bills.html:68
#: templates/list_bills.html:80
msgid "The project identifier is"
msgstr "L'identifiant de ce projet est"
#: templates/list_bills.html:68
msgid "remember it or add this page to you bookmarks!"
msgstr "rapellez vous en !"
#: templates/list_bills.html:80
msgid "remember it!"
msgstr "souvenez vous en !"
#: templates/list_bills.html:70
#: templates/list_bills.html:81
msgid "Add a new bill"
msgstr "Nouvelle facture"
#: templates/list_bills.html:72
#: templates/list_bills.html:83
msgid "hide this form"
msgstr "cacher ce formulaire"
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "When?"
msgstr "Quand ?"
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "Who paid?"
msgstr "Qui à payé ?"
msgstr "Qui a payé ?"
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "For what?"
msgstr "Pour quoi ?"
#: templates/list_bills.html:78
msgid "Owers"
msgstr "Pour qui ?"
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "How much?"
msgstr "Combien ?"
#: templates/list_bills.html:78
#: templates/list_bills.html:89
msgid "Actions"
msgstr "Actions"
#: templates/list_bills.html:87
#: templates/list_bills.html:97
msgid "each"
msgstr "chacun"
#: templates/list_bills.html:98
msgid "edit"
msgstr "éditer"
#: templates/list_bills.html:95
#: templates/list_bills.html:106
msgid "Nothing to list yet. You probably want to"
msgstr "Rien à lister pour l'instant. Vous voulez surement"
#: templates/list_bills.html:95
#: templates/list_bills.html:106
msgid "add a bill"
msgstr "ajouter une facture"
@ -449,8 +453,3 @@ msgstr "sauter cette étape"
msgid "and notify them yourself"
msgstr "et les notifier vous même"
msgid "each"
msgstr "chacun"
msgid "Bills can't be negative"
msgstr "Le montant d'une facture ne peut pas être négatif"

View file

@ -235,10 +235,14 @@ def invite():
@main.route("/<project_id>/")
def list_bills():
bill_form=get_billform_for(g.project)
# set the last selected payer as default choice if exists
if 'last_selected_payer' in session:
bill_form.payer.data = session['last_selected_payer']
bills = g.project.get_bills()
return render_template("list_bills.html",
bills=bills, member_form=MemberForm(g.project),
bill_form=get_billform_for(g.project)
bill_form=bill_form
)
@main.route("/<project_id>/members/add", methods=["GET", "POST"])
@ -280,6 +284,10 @@ def add_bill():
form = get_billform_for(g.project)
if request.method == 'POST':
if form.validate():
# save last selected payer in session
session['last_selected_payer'] = form.payer.data
session.update()
bill = Bill()
db.session.add(form.save(bill, g.project))
db.session.commit()