If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


First in the Controller  add the Following Code : 


def events():
        response.flash = 'Welcome %s , Please Select A Date , So i Can look up All The User Events In That Date :)' %(auth.user.first_name)
        events = db().select(db.auth_event.ALL,orderby=~db.auth_event.id)
        userevent = ''
        eventlist = []
        for i in events:
            if not str(i.time_stamp)[:10] in eventlist:
        if request.vars:
            if request.vars.timestamp2:
                response.flash = 'All the Users with events from %s to %s' %(request.vars.timestamp,request.vars.timestamp2)
                userevent = db(db.auth_event.time_stamp[:10] >= request.vars.timestamp and db.auth_event.time_stamp[:10] <= request.vars.timestamp2).select(db.auth_event.ALL)
                response.flash = 'All the Users with events on %s' %(request.vars.timestamp)
                userevent = db(db.auth_event.time_stamp[:10] == request.vars.timestamp).select(db.auth_event.ALL)
        return locals()


Secound create default/events page and add the following code : 

{{extend 'layout.html'}}


border:1px solid #CCCCCC!important;

<form method="post" action="{{=URL('events')}}" id="eventform">
<legend>User Event Filteration</legend>
Date IN : <select name="timestamp" id="timestamp" style="width:350px" >

{{for i in eventlist:}}
  <option value="{{=i}}" >{{=str(i)[:11]}}</option>
<input type="submit"/>
<div style="clear:both"></div>
<span id="removef" style="color:blue">[ &nbsp Remove Period Time Filteration &nbsp ]</span>
<span id="addf" style="color:blue">[&nbsp Add Period Time Filteration &nbsp ]</span><br><br>

<p style="color:red">{{=response.flash or ''}}</p>


$('#eventform input[type=submit]').before('Date To : <select name="timestamp2" id="timestamp2" style="width:350px" >{{for i in eventlist:}}<option value="{{=i}}" >{{=str(i)[:11]}}</option>{{pass}}</select><br></br>');



Related slices

Comments (0)

Hosting graciously provided by:
Python Anywhere