def test_extends_models(self): m = db.get_model('foo:foo') self.assertEqual(m.__module__, "foo_extended.models") self.assertEqual(m._meta.package, "foo") m = db.get_model('foo:fox') self.assertEqual(m.__module__, "foo_extended.models") self.assertEqual(m._meta.package, "foo")
def search(): q = request.args.get('q', '') revisions = None if q.strip(): Revision = db.get_model('wiki:revision') query = Revision.all().filter(Q('text =', '%'+q+'%')|Q('note =', '%'+q+'%')) revisions = query.fetchall() return web.render_template('search.html', revisions=revisions)