diff --git a/pylons_app/controllers/repos.py b/pylons_app/controllers/repos.py --- a/pylons_app/controllers/repos.py +++ b/pylons_app/controllers/repos.py @@ -20,7 +20,7 @@ class ReposController(BaseController): def index(self, format='html'): """GET /repos: All items in the collection""" # url('repos') - return render('/repos_manage.html') + return render('/repos.html') def create(self): """POST /repos: Create a new item""" @@ -51,7 +51,7 @@ class ReposController(BaseController): def show(self, id, format='html'): """GET /repos/id: Show a specific item""" # url('repo', id=ID) - + return render('/repos_show.html') def edit(self, id, format='html'): """GET /repos/id/edit: Form to edit an existing item""" # url('edit_repo', id=ID) diff --git a/pylons_app/controllers/users.py b/pylons_app/controllers/users.py --- a/pylons_app/controllers/users.py +++ b/pylons_app/controllers/users.py @@ -16,14 +16,15 @@ class UsersController(BaseController): c.staticurl = g.statics c.admin_user = session.get('admin_user') c.admin_username = session.get('admin_username') + self.conn, self.cur = auth.get_sqlite_conn_cur() def index(self, format='html'): """GET /users: All items in the collection""" # url('users') - conn, cur = auth.get_sqlite_conn_cur() - cur.execute('SELECT * FROM users') - c.users_list = cur.fetchall() - return render('/users_manage.html') + + self.cur.execute('SELECT * FROM users') + c.users_list = self.cur.fetchall() + return render('/users.html') def create(self): """POST /users: Create a new item""" @@ -50,11 +51,22 @@ class UsersController(BaseController): # h.form(url('user', id=ID), # method='delete') # url('user', id=ID) - + try: + self.cur.execute("DELETE FROM users WHERE user_id=?", (id,)) + self.conn.commit() + except: + self.conn.rollback() + raise + return redirect(url('users')) + def show(self, id, format='html'): """GET /users/id: Show a specific item""" # url('user', id=ID) - + self.cur.execute("SELECT * FROM users WHERE user_id=?", (id,)) + ret = self.cur.fetchone() + c.user_name = ret[1] + return render('/users_show.html') + def edit(self, id, format='html'): """GET /users/id/edit: Form to edit an existing item""" # url('edit_user', id=ID) diff --git a/pylons_app/lib/auth.py b/pylons_app/lib/auth.py --- a/pylons_app/lib/auth.py +++ b/pylons_app/lib/auth.py @@ -84,7 +84,7 @@ def create_user_table(): log.info('creating table %s', 'users') cur.execute('''DROP TABLE IF EXISTS users ''') cur.execute('''CREATE TABLE users - (id INTEGER PRIMARY KEY AUTOINCREMENT, + (user_id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT, active INTEGER, diff --git a/pylons_app/public/hg_static/style-monoblue.css b/pylons_app/public/hg_static/style-monoblue.css --- a/pylons_app/public/hg_static/style-monoblue.css +++ b/pylons_app/public/hg_static/style-monoblue.css @@ -64,7 +64,21 @@ div.page-header { div.rss_logo a:hover { background-color:#ee5500; } - +input.submit{ + background-color:#FF6600; + border-color:#FCC7A5 #7D3302 #3E1A01 #FF954E; + border-style:solid; + border-width:1px; + color:#FFFFFF; + font-family:sans-serif; + font-size:10px; + font-weight:bold; + line-height:8px; + padding:1px 2px; + text-align:center; + text-decoration:none; + cursor: pointer; +} td.indexlinks { white-space: nowrap; } diff --git a/pylons_app/templates/base/base.html b/pylons_app/templates/base/base.html --- a/pylons_app/templates/base/base.html +++ b/pylons_app/templates/base/base.html @@ -20,7 +20,7 @@ ${next.main()}
| Id | Username | -Password | Active | Admin | +Action | |
|---|---|---|---|---|---|---|
| ${i[0]} | -${i[1]} | -${i[2]} | +${h.link_to(i[1],h.url('user', id=i[0]))} | ${i[3]} | ${i[4]} | ++ ${h.form(url('user', id=i[0]),method='delete')} + ${h.submit('remove','remove',class_="submit")} + ${h.end_form()} + |