[web2py] Re: ekjaa

2011-07-03 Thread Mohit
Thank you all for the kind words!

Yes, it is a web2py website :)

@Mikech: We are in the process of fixing the bugs and it should be
resolved soon.

We request you all to go through the website and let us know your
feedback. It will help us greatly in further enhancing the website.

You can contact me at mohit.gu...@ekjaa.org for any queries/feedback.


Regards
Mohit

On Jun 23, 9:46 pm, Anthony  wrote:
> On Thursday, June 23, 2011 12:38:29 PM UTC-4, mikech wrote:
>
> > Is this a web2py site?
>
> Yes, you can tell if you look at the meta tags in the html head. The http
> response also includes x-powered-by=web2py.


[web2py] Create SQLFORM having one submit button for 2 distinct tables

2016-05-22 Thread Mohit Jain
Hello,
I have 2 tables (ApplicationDeadline & NominationDeadline). Both of 
them have only 2 fields (start-time and end-time). I would like to create a 
form where the user can see 4 fields and only one submit button that can be 
used to insert new values of these fields. Only the fields that have been 
filled by the user must be inserted (blank fields must not have new 
insertions). This is somewhat similar to what is given in the manual 
(http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables)
 
however, I don't have a common foreign-key (like the client-id of the given 
example) and hence would like to know how to do such a thing, if at all 
possible.

models/db.py
###
# Set the Application Period Deadline.#
###
db.define_table(
'AppDeadline',
Field('start','datetime',required=True, label='Start Time'),
Field('end','datetime',required=True, label='End Time')
)


###
# Set the Nomination Period Deadline.#
###
db.define_table(
'NomDeadline',
Field('start','datetime',required=True, label='Start Time'),
Field('end','datetime',required=True, label='End Time')
)

What I want is *something like,* 

form = SQLFORM.factory(db.AppDeadline, db.NomDeadline)
if form.process().accepted:
if form.vars.appTime: #To check if application-fields have been updated
response.flash = 'Application Period Set : '+str(form.vars.start)+' 
to '+str(form.vars.end)
db.UserLogs.insert(activity='Application Period Set : '+str(form.
vars.start)+' to '+str(form.vars.end))
if form.vars.nomTime: #To check if nomination-fields have been updated
response.flash = 'Nomination Period Set : '+str(form.vars.start)+' 
to '+str(form.vars.end)
db.UserLogs.insert(activity='Nomination Period Set : '+str(form.vars
.start)+' to '+str(form.vars.end))
elif form.errors:
response.flash = 'Form has error(s)!'


Regards,
Mohit

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Create SQLFORM having one submit button for 2 distinct tables

2016-05-23 Thread Mohit Jain
Thanks Anthony for your suggestion! Works just fine :)

For anyone looking at a similar problem, here's what I've done now.

form = SQLFORM.factory(
Field('appStart','datetime',label='App-Period Start Time'),
Field('appEnd','datetime',label='App-Period End Time'),
Field('nomStart','datetime',label='Nom-Period Start Time'),
Field('nomEnd','datetime',label='Nom-Period End Time')
   )

if form.process().accepted:
app_msg_flash = 'Application Period Unchanged'
nom_msg_flash = 'Nomination Period Unchanged'
if form.vars.appStart:
if not form.vars.appEnd:
session.flash = 'Application Period End-Time not specified!'
redirect(URL('overall_admin','set_deadline'))
else:
db.AppDeadline.insert(start=form.vars.appStart, 
end=form.vars.appEnd)
db.UserLogs.insert(activity='Application Period Set : 
'+str(form.vars.appStart)+' to '+str(form.vars.appEnd))
app_msg_flash = 'Application Period Set : 
'+str(form.vars.appStart)+' to '+str(form.vars.appEnd)
elif form.vars.appEnd:
session.flash = 'Application Period Start-Time not specified!'
redirect(URL('overall_admin','set_deadline'))
if form.vars.nomStart:
if not form.vars.nomEnd:
session.flash = 'Nomination Period End-Time not specified!'
redirect(URL('overall_admin','set_deadline'))
else:
db.NomDeadline.insert(start=form.vars.nomStart, 
end=form.vars.nomEnd)
db.UserLogs.insert(activity='Nomination Period Set : 
'+str(form.vars.nomStart)+' to '+str(form.vars.nomEnd))
nom_msg_flash = 'Nomination Period Set : 
'+str(form.vars.nomStart)+' to '+str(form.vars.nomEnd)
elif form.vars.nomEnd:
session.flash = 'Nomination Period Start-Time not specified!'
redirect(URL('overall_admin','set_deadline'))

response.flash = DIV(app_msg_flash,BR(),nom_msg_flash)
elif form.errors:
response.flash = 'Deadlines not Set : Form has error(s)!'



On Sunday, May 22, 2016 at 11:31:27 PM UTC+5:30, Mohit Jain wrote:
>
> Hello,
> I have 2 tables (ApplicationDeadline & NominationDeadline). Both of 
> them have only 2 fields (start-time and end-time). I would like to create a 
> form where the user can see 4 fields and only one submit button that can be 
> used to insert new values of these fields. Only the fields that have been 
> filled by the user must be inserted (blank fields must not have new 
> insertions). This is somewhat similar to what is given in the manual (
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables)
>  
> however, I don't have a common foreign-key (like the client-id of the given 
> example) and hence would like to know how to do such a thing, if at all 
> possible.
>
> models/db.py
> ###
> # Set the Application Period Deadline.#
> ###
> db.define_table(
> 'AppDeadline',
> Field('start','datetime',required=True, label='Start Time'),
> Field('end','datetime',required=True, label='End Time')
> )
>
>
> ###
> # Set the Nomination Period Deadline.#
> ###
> db.define_table(
> 'NomDeadline',
> Field('start','datetime',required=True, label='Start Time'),
> Field('end','datetime',required=True, label='End Time')
> )
>
> What I want is *something like,* 
>
> form = SQLFORM.factory(db.AppDeadline, db.NomDeadline)
> if form.process().accepted:
> if form.vars.appTime: #To check if application-fields have been 
> updated
> response.flash = 'Application Period Set : '+str(form.vars.start)+' 
> to '+str(form.vars.end)
> db.UserLogs.insert(activity='Application Period Set : '+str(form.
> vars.start)+' to '+str(form.vars.end))
> if form.vars.nomTime: #To check if nomination-fields have been updated
> response.flash = 'Nomination Period Set : '+str(form.vars.start)+' 
> to '+str(form.vars.end)
> db.UserLogs.insert(activity='Nomination Period Set : '+str(form.
> vars.start)+' to '+str(form.vars.end))
> elif form.errors:
> response.flash = 'Form has error(s)!'
>
>
> Regards,
> Mohit
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Setting up the scheduler, and letting it run from a certain point of time

2016-05-28 Thread Mohit Jain
I am stuck with a similar situation here.

I have the models/scheduler.py
from gluon.scheduler import Scheduler

def auto_insert():
try:

db.UserLogs(user_name='temp',user_email='a...@as.com',activity='checking 
scheduler')
return 'inserted'
except:
return 'failed'

scheduler = Scheduler(db, dict(auto_insert=auto_insert))


And I run the scheduler tasks as
[taship@taship web2py]$ python web2py.py -K taportaltest
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2016
Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
Ingres(pyodbc), IMAP(imaplib)
starting single-scheduler for "taportaltest"...

Then I use the appadmin to start the background tasks.
Application Name: 
Task Name: 
Group Name: 
Status: QUEUEDRUNNINGCOMPLETEDFAILEDTIMEOUTSTOPPEDEXPIRED 
Function Name: auto_insert 
Uuid: 
Args: 
Vars: 
Enabled: 
Start Time: 
Next Run Time: 
Stop Time: 
Repeats: 0=unlimited
Retry Failed: -1=unlimited
Period: seconds
Prevent Drift: Cron-like start_times between runs
Timeout: seconds
Sync Output: update output every n sec: 0=never
Times Run: 
Times Failed: 
Last Run Time: 
Assigned Worker Name: 

and things seem to be fine...


scheduler_run.id 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.id>
scheduler_run.task_id 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.task_id>
scheduler_run.status 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.status>
scheduler_run.start_time 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.start_time>
scheduler_run.stop_time 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.stop_time>
scheduler_run.run_output 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.run_output>
scheduler_run.run_result 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.run_result>
scheduler_run.traceback 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.traceback>
scheduler_run.worker_name 
<http://localhost:8001/taportaltest/appadmin/select/db?orderby=scheduler_run.worker_name>
6 <http://localhost:8001/taportaltest/appadmin/update/db/scheduler_run/6> 
auto-insert 
<http://localhost:8001/taportaltest/appadmin/update/db/scheduler_task/2> 
COMPLETED 2016-05-28 16:18:47 2016-05-28 16:18:47 "inserted" None 
taship.iiit.a...
7 <http://localhost:8001/taportaltest/appadmin/update/db/scheduler_run/7> 
auto-insert 
<http://localhost:8001/taportaltest/appadmin/update/db/scheduler_task/2> 
COMPLETED 2016-05-28 16:19:06 2016-05-28 16:19:07 "inserted" None 
taship.iiit.a...
8 <http://localhost:8001/taportaltest/appadmin/update/db/scheduler_run/8> 
auto-insert 
<http://localhost:8001/taportaltest/appadmin/update/db/scheduler_task/2> 
COMPLETED 2016-05-28 16:19:22 2016-05-28 16:19:22 "inserted" None 
taship.iiit.a...
9 <http://localhost:8001/taportaltest/appadmin/update/db/scheduler_run/9> 
auto-insert 
<http://localhost:8001/taportaltest/appadmin/update/db/scheduler_task/2> 
COMPLETED 2016-05-28 16:19:38 2016-05-28 16:19:40 "inserted" None 
taship.iiit.a...
10 <http://localhost:8001/taportaltest/appadmin/update/db/scheduler_run/10> 
auto-insert 
<http://localhost:8001/taportaltest/appadmin/update/db/scheduler_task/2> 
COMPLETED 2016-05-28 16:19:55 2016-05-28 16:19:56 "inserted" None

But the database (db.UserLogs) is not being updated :/

What am I missing here? Do I need to specifically import the database 
classes into scheduler.py?

Regards,
Mohit

On Thursday, February 25, 2016 at 1:41:04 PM UTC+5:30, Niphlod wrote:
>
> if anyone wants to familiarize with the scheduler, I always recommend 
> https://github.com/niphlod/w2p_scheduler_tests 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fniphlod%2Fw2p_scheduler_tests&sa=D&sntz=1&usg=AFQjCNEmvCBDd7yA9iLv9ZtUdQkrJ5QMvQ>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Using Scheduler to delete database rows older than a timestamp

2016-03-03 Thread Mohit Jain
Hello,
I would like to know how can one delete rows from a web2py table where 
if a specific field (a timestamp) is older than 24hours? I would like this 
process to keep running in the background in fixed time-intervals (every 5 
minutes or so) and delete entries from the table where this field is older 
than 24hours from the current time. I know using the Scheduler is probably 
the correct way to go about it but I'm unable to figure out the exact code 
to be written (the documentation has too many options and hence a bit 
confusing). Looking for code samples! :)

Regards,
Mohit

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.