fix deleting items

This commit is contained in:
j 2014-05-22 11:20:30 +02:00
parent 5bbf612a38
commit 0a95189a52
2 changed files with 5 additions and 0 deletions

View file

@ -398,6 +398,7 @@ class Item(db.Model):
db.session.commit() db.session.commit()
if not self.users: if not self.users:
db.session.delete(self) db.session.delete(self)
Sort.query.filter_by(item_id=self.id).delete()
else: else:
self.update() self.update()
Changelog.record(user, 'removeitem', self.id) Changelog.record(user, 'removeitem', self.id)

View file

@ -100,6 +100,10 @@ class ApiHandler(tornado.web.RequestHandler):
def initialize(self, app): def initialize(self, app):
self._app = app self._app = app
def get(self):
self.write('use POST')
self.finish()
@tornado.web.asynchronous @tornado.web.asynchronous
@tornado.gen.coroutine @tornado.gen.coroutine
def post(self): def post(self):