Esempio n. 1
0
def sa_list(request):
    from sacrud.pyramid_ext import DBSession
    tname = request.matchdict['table']
    order_by = request.params.get('order_by', False)
    args = [DBSession, get_table(tname, request)]
    if order_by:
        args.append(order_by)
    resp = action.index(*args)
    return {'sa_crud': resp, 'breadcrumbs': breadcrumbs(tname, 'sa_list')}
Esempio n. 2
0
    def test_index(self):
        user = User(u'Vasya', u'Pupkin', u"123")

        self.session.add(user)
        transaction.commit()

        result = index(self.session, User)
        user = self.session.query(User).get(1)

        self.assertEqual(result['pk'], 'id')
        self.assertEqual(result["prefix"], "crud")
        self.assertEqual(result["table"], User)
        self.assertEqual(result["row"], [user, ])

        self.session.delete(user)
Esempio n. 3
0
    def test_index(self):
        user = User(u'Vasya', u'Pupkin', u"123")

        self.session.add(user)
        transaction.commit()

        result = index(self.session, User)
        user = self.session.query(User).get(1)

        self.assertEqual(result['pk'], 'id')
        self.assertEqual(result["prefix"], "crud")
        self.assertEqual(result["table"], User)
        self.assertEqual(result["row"], [
            user,
        ])

        self.session.delete(user)