[web2py] Re: web2py - date picker issue
Please identify what part of this rather long file is relevant to your question. You might also want to look at the documentation for SQLFORM with regard ti how to use keepvalues. On Wednesday, May 6, 2020 at 9:44:37 AM UTC-4, Anuj Mahawar wrote: > > Yes, its part of the SQLFORM. I have attached my file from the controller. > Could you please let me know where do I need to make the changes (i.e. > keepvalues = True) > > Regards, > Anuj > > On Tuesday, May 5, 2020 at 6:38:29 PM UTC+5:30, Scott Hunter wrote: >> >> If this is part of a form (which I have to guess at, since you have >> provided *no* details), you can use the `keepvalues` option to not reset >> the fields of a form. >> >> On Tuesday, May 5, 2020 at 8:24:32 AM UTC-4, Anuj Mahawar wrote: >>> >>> Hey Scott, >>> Yeah, I meant that the date is resetting to the current date even though >>> I am selecting any previous date. Do you have any suggestions to change >>> this default behavior? >>> >>> On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote: What do you mean by "redirected"? If you just mean that the date field is reset to the current date, that is the same default behavior for all input fields. On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote: > > I am a beginner to the web2py. I am building an application with a > date picker on the home page. The issue is - Whenever I try to edit a > previous day's record and submit, instead of on being on the same date, > it > is being redirected to the current date page. e.g. suppose I have logged > in > and it displays the current date i.e. 29 April 2020. When I try to edit a > record for 01 April 2020 and submit the entry, it is being redirected to > the current date i.e. 29 April 2020. Any idea why the application is > behaving like that? > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d77ee4d0-7c07-42db-bd9c-3715e947b935%40googlegroups.com.
[web2py] Re: web2py - date picker issue
Yes, its part of the SQLFORM. I have attached my file from the controller. Could you please let me know where do I need to make the changes (i.e. keepvalues = True) Regards, Anuj On Tuesday, May 5, 2020 at 6:38:29 PM UTC+5:30, Scott Hunter wrote: > > If this is part of a form (which I have to guess at, since you have > provided *no* details), you can use the `keepvalues` option to not reset > the fields of a form. > > On Tuesday, May 5, 2020 at 8:24:32 AM UTC-4, Anuj Mahawar wrote: >> >> Hey Scott, >> Yeah, I meant that the date is resetting to the current date even though >> I am selecting any previous date. Do you have any suggestions to change >> this default behavior? >> >> On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote: >>> >>> What do you mean by "redirected"? If you just mean that the date field >>> is reset to the current date, that is the same default behavior for all >>> input fields. >>> >>> On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote: I am a beginner to the web2py. I am building an application with a date picker on the home page. The issue is - Whenever I try to edit a previous day's record and submit, instead of on being on the same date, it is being redirected to the current date page. e.g. suppose I have logged in and it displays the current date i.e. 29 April 2020. When I try to edit a record for 01 April 2020 and submit the entry, it is being redirected to the current date i.e. 29 April 2020. Any idea why the application is behaving like that? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/197d1e24-a50d-4ec8-b6a5-a517beed0f04%40googlegroups.com. # -*- coding: utf-8 -*- # - # This is a sample controller # this file is released under public domain and you can use without limitations # - # example index page def index(): if not session.logged_in_user: redirect(URL('login')) import datetime form=SQLFORM(db.ts_date,buttons=[]) for row in form.element('table'): del row[0] message = pull_home_data() #except Exception,e: # response.flash='Something wrong! '+str(e) return locals() def pull_home_data(): if not session.logged_in_user: redirect(URL('login')) import datetime date = '' message='' ts_data='' html = '' userid = session.user_id inst_prod='' sum_time=datetime.timedelta() if 1: if request.post_vars.date: date = date=datetime.datetime.strptime(request.post_vars.date,"%d %B %Y").date() else: date = request.now ts_data = db((db.ts_data.date_worked == date) & (db.ts_data.username==userid)).select(db.ts_data.id,db.ts_data.product_Name,db.ts_data.time_worked,db.ts_data.comments,db.ts_data.date_worked,orderby=db.ts_data.id) if ts_data: total_time = [str(x['time_worked']) for x in ts_data] for y in total_time: (h, m, s) = y.split(':') d = datetime.timedelta(hours=int(h), minutes=int(m)) sum_time += d html += 'Total Hours Worked '+str(sum_time)[:-3]+'' ts_prod = list(set(row['product_Name'] for row in ts_data)) for row in ts_prod: sum_ptime = datetime.timedelta() total_prod_time = [str(x['time_worked']) for x in ts_data if x['product_Name'] == row] for u in total_prod_time: (h, m, s) = u.split(':') pt = datetime.timedelta(hours=int(h), minutes=int(m)) sum_ptime += pt html += '' + str(row['product_name']) + 'Total Hrs '+str(sum_ptime)[:-3]+'' for dat in ts_data: if row == dat['product_Name']: html += ' DeleteEdit' task_data = db(db.ts_task_data.transaction_id == dat['id']).select(db.ts_task_data.lable_name,db.ts_task_data.value) for i in task_data: lable = db(db.ts_form.id == i['lable_name']).select(db.ts_form.lable_name) if lable: if '|' in i['value']: itms = i['value'].split('|') html += ''+str(lable[0]['lable_name'])+''+str(itms[0])+''
[web2py] Re: web2py - date picker issue
If this is part of a form (which I have to guess at, since you have provided *no* details), you can use the `keepvalues` option to not reset the fields of a form. On Tuesday, May 5, 2020 at 8:24:32 AM UTC-4, Anuj Mahawar wrote: > > Hey Scott, > Yeah, I meant that the date is resetting to the current date even though I > am selecting any previous date. Do you have any suggestions to change this > default behavior? > > On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote: >> >> What do you mean by "redirected"? If you just mean that the date field >> is reset to the current date, that is the same default behavior for all >> input fields. >> >> On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote: >>> >>> I am a beginner to the web2py. I am building an application with a date >>> picker on the home page. The issue is - Whenever I try to edit a previous >>> day's record and submit, instead of on being on the same date, it is being >>> redirected to the current date page. e.g. suppose I have logged in and it >>> displays the current date i.e. 29 April 2020. When I try to edit a record >>> for 01 April 2020 and submit the entry, it is being redirected to the >>> current date i.e. 29 April 2020. Any idea why the application is behaving >>> like that? >>> >>> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2c1f0cb7-0ba7-4f3b-a54b-bdc2d3f5ead1%40googlegroups.com.
[web2py] Re: web2py - date picker issue
Hey Scott, Yeah, I meant that the date is resetting to the current date even though I am selecting any previous date. Do you have any suggestions to change this default behavior? On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote: > > What do you mean by "redirected"? If you just mean that the date field is > reset to the current date, that is the same default behavior for all input > fields. > > On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote: >> >> I am a beginner to the web2py. I am building an application with a date >> picker on the home page. The issue is - Whenever I try to edit a previous >> day's record and submit, instead of on being on the same date, it is being >> redirected to the current date page. e.g. suppose I have logged in and it >> displays the current date i.e. 29 April 2020. When I try to edit a record >> for 01 April 2020 and submit the entry, it is being redirected to the >> current date i.e. 29 April 2020. Any idea why the application is behaving >> like that? >> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8b558fe5-7a18-4389-a82f-99df8bff0e1c%40googlegroups.com.
[web2py] Re: web2py - date picker issue
What do you mean by "redirected"? If you just mean that the date field is reset to the current date, that is the same default behavior for all input fields. On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote: > > I am a beginner to the web2py. I am building an application with a date > picker on the home page. The issue is - Whenever I try to edit a previous > day's record and submit, instead of on being on the same date, it is being > redirected to the current date page. e.g. suppose I have logged in and it > displays the current date i.e. 29 April 2020. When I try to edit a record > for 01 April 2020 and submit the entry, it is being redirected to the > current date i.e. 29 April 2020. Any idea why the application is behaving > like that? > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/f7e96af3-d922-4f51-aab4-3bcf0d9d4fcf%40googlegroups.com.