changeset 130:d034b1541bf1

Fixes to named queries management interface.
author Daniele Nicolodi <daniele@grinta.net>
date Fri, 14 Oct 2011 11:05:31 +0200
parents 5bf7dc63466d
children a4a1b9f582cd
files src/ltpdarepo/query.py src/ltpdarepo/views/queries.py
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/query.py	Fri Oct 14 10:57:26 2011 +0200
+++ b/src/ltpdarepo/query.py	Fri Oct 14 11:05:31 2011 +0200
@@ -66,7 +66,6 @@
 
     def tostring(self):
         criteria = json.loads(self.query)
-        print criteria
         query = ["%s %s '%s'" % (field, op, value) for field, op, value in criteria]
         string = ' AND&nbsp;'.join(s.replace(' ', '&nbsp;') for s in query)
         return Markup(string)
--- a/src/ltpdarepo/views/queries.py	Fri Oct 14 10:57:26 2011 +0200
+++ b/src/ltpdarepo/views/queries.py	Fri Oct 14 11:05:31 2011 +0200
@@ -63,8 +63,8 @@
     if request.method == 'POST' and form.validate():
         form.update(query)
         query.save()
-        return redirect(url_for('.index'))
-    return render_template('queries/edit.html', form=form)
+        return redirect(url_for('.view', id=id))
+    return render_template('queries/edit.html', form=form, query=query)
 
 
 class IConfirm(Form):
@@ -86,7 +86,7 @@
             flash('Named query deleted.')
             return redirect(url_for('manage.queries.index'))
         flash('Operation cancelled.')
-        return redirect(url_for('manage.queries.index'))
+        return redirect(url_for('.view', id=id))
     return render_template('queries/drop.html', form=form, query=query)