Changeset - 6f524697f79d
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 16 years ago 2010-04-17 19:07:29
marcin@python-blog.com
Implemented paging to admin user acion log
2 files changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/admin.py
Show inline comments
 
@@ -14,6 +14,7 @@ import formencode
 
import formencode.htmlfill as htmlfill
 
from pylons_app.model import meta
 
from pylons_app.model.db import Users, UserLogs
 
from webhelpers.paginate import Page
 
log = logging.getLogger(__name__)
 

	
 
class AdminController(BaseController):
 
@@ -53,8 +54,11 @@ class AdminController(BaseController):
 
                )
 
        if c.admin_user:
 
            sa = meta.Session
 
            c.users_log = sa.query(UserLogs)\
 
                .order_by(UserLogs.action_date.desc()).limit(10).all()
 
                             
 
            users_log = sa.query(UserLogs)\
 
                .order_by(UserLogs.action_date.desc())
 
            p = int(request.params.get('page', 1))
 
            c.users_log = Page(users_log, page=p, items_per_page=10)
 
        return render('/admin.html')
 

	
 
    def hgrc(self, dirname):
pylons_app/templates/admin.html
Show inline comments
 
@@ -51,6 +51,9 @@
 
					<td>${l.action_date}</td>
 
				</tr>
 
			%endfor
 
			<tr>
 
				<td>${c.users_log.pager('$link_previous ~2~ $link_next')}</td>
 
			</tr>
 
			</table>        
 
		%else:
 
			${_('No actions yet')}
0 comments (0 inline, 0 general)