diff --git a/budget/forms.py b/budget/forms.py index 713bcfb7..8db90be6 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -56,7 +56,6 @@ class EditProjectForm(Form): name = TextField(_("Project name"), validators=[Required()]) password = TextField(_("Private code"), validators=[Required()]) contact_email = TextField(_("Email"), validators=[Required(), Email()]) - submit = SubmitField(_("Edit the project")) def save(self): """Create a new project with the information given by this form. diff --git a/budget/models.py b/budget/models.py index 152ad341..b8897946 100644 --- a/budget/models.py +++ b/budget/models.py @@ -70,6 +70,10 @@ class Project(db.Model): db.session.commit() return person + def remove_project(self): + db.session.delete(self) + db.session.commit() + def __repr__(self): return "" % self.name diff --git a/budget/templates/edit_project.html b/budget/templates/edit_project.html index 0349fe74..e84ad97c 100644 --- a/budget/templates/edit_project.html +++ b/budget/templates/edit_project.html @@ -1,5 +1,12 @@ {% extends "layout.html" %} +{% block js %} + $('#delete-project').click(function () + { + $(this).html("{{_("you sure?")}}"); + }); +{% endblock %} + {% block content %}

{{ _("Edit this project") }}

diff --git a/budget/templates/forms.html b/budget/templates/forms.html index 0a06001d..9e5ecd65 100644 --- a/budget/templates/forms.html +++ b/budget/templates/forms.html @@ -65,7 +65,10 @@ {{ input(form.name) }} {{ input(form.password) }} {{ input(form.contact_email) }} - {{ submit(form.submit) }} +
+ + {{ _("delete") }} +
{% endmacro %} diff --git a/budget/templates/layout.html b/budget/templates/layout.html index c8f8df84..6ac0a3a6 100644 --- a/budget/templates/layout.html +++ b/budget/templates/layout.html @@ -9,6 +9,8 @@ {% block head %}{% endblock %}