mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Adding bill works
This commit is contained in:
parent
8dd2091f31
commit
e9b9a06779
6 changed files with 18 additions and 6 deletions
3
TODO
3
TODO
|
@ -1,2 +1,3 @@
|
|||
* Find a way to make the couple (name, project) unique.
|
||||
* use a psql backend rather than sqlite
|
||||
* Use a psql backend rather than sqlite
|
||||
* If the members list of a project is empty, propose the user to define the members
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{% extends "layout.html" %}
|
||||
|
||||
{% block top_menu %}
|
||||
<a href="{{ url_for('list_bills', project_id=project.id) }}">Back to the list</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Let's add a bill</h2>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% block content %}
|
||||
<h2>Welcome on the budget manager</h2>
|
||||
|
||||
<form action="{{ url_for('authenticate') }}" method="post" accept-charset="utf-8">
|
||||
<form action="{{ url_for('authenticate') }}" method="post" accept-charset="utf-8" style="float:left; width: 50%;">
|
||||
<h3>Log to an existing project...</h3>
|
||||
|
||||
{{ auth_form.hidden_tag() }}
|
||||
|
@ -13,7 +13,7 @@
|
|||
<p>{{ auth_form.submit }}</p>
|
||||
</form>
|
||||
|
||||
<form action="{{ url_for('create_project') }}" method="post" class="container span-24 add-bill">
|
||||
<form action="{{ url_for('create_project') }}" method="post" class="container span-24 add-bill" style="float:right; width: 50%;">
|
||||
<h3>...or create a new project</h3>
|
||||
|
||||
{{ project_form.hidden_tag() }}
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
{% extends "layout.html" %}
|
||||
|
||||
{% block top_menu %}
|
||||
<ul>
|
||||
<li><a href="{{ url_for('add_bill', project_id=project.id) }}">Add a bill</a></li>
|
||||
<li><a href="{{ url_for('add_member', project_id=project.id) }}">Add a member</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="leftmenu" class="span-6">
|
||||
<ul>
|
||||
|
@ -7,7 +15,7 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
{% set form=member_form %}
|
||||
{% include "member_form.html" %}
|
||||
{#% include "member_form.html" %#}
|
||||
</div>
|
||||
<div id="content" class="span-18 last">
|
||||
{% if bills.count() > 0 %}
|
||||
|
|
|
@ -7,7 +7,7 @@ from forms import BillForm
|
|||
def get_billform_for(project_id):
|
||||
"""Return an instance of BillForm configured for a particular project."""
|
||||
form = BillForm()
|
||||
payers = [(m.id, m.name) for m in Project.query.get("blah").members]
|
||||
payers = [(m.id, m.name) for m in Project.query.get(project_id).members]
|
||||
form.payed_for.choices = form.payer.choices = payers
|
||||
return form
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ def add_member(project):
|
|||
@app.route("/<string:project_id>/add", methods=["GET", "POST"])
|
||||
@requires_auth
|
||||
def add_bill(project):
|
||||
# FIXME: make it work.
|
||||
form = get_billform_for(project.id)
|
||||
if request.method == 'POST':
|
||||
if form.validate():
|
||||
|
|
Loading…
Reference in a new issue