[web2py] SQLFORM.widget form field length style change after submit

2016-07-13 Thread
let say i have a code *models/db.py* db.test.name.requires = IS_NOT_EMPTY() db.test.address.requires = IS_NOT_EMPTY() db.test.name.widget = lambda field,value: SQLFORM.widgets.string.widget(field, value, _placeholder = T('Name should be filled') ) db.test.address.widget = lambda field,value:

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-11 Thread
yes, you have a nice trick on your code, thanks so much massimo e.g. # -*- coding: utf-8 -*- # index def index(): filename = os.path.join(request.folder, 'databases', 'idx_tables.index') if not os.path.exists(filename): # create index : auth_user db.executesql('CREATE INDEX idx_auth_user ON

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-11 Thread
thanks so much for the nice trick, create the file on web2py databases folder after execute 'CREATE INDEX' pardon, i think it's not efficient, pls imagine if there are a lot of tables, and execute the controllers/install.py to have a lot of conditional check for each file for each table that

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-11 Thread
thanks all, that can do, but CREATE INDEX IF NOT EXISTS, it's not work in mysql (pls correct me if i'm wrong), so i use the universal code that can cover all of it, of course i think i can create conditional for check for the database connection base on environment. in my environment are -

[web2py] running web2py module from terminal takes long time

2016-07-09 Thread
i have a code : *controllers/install.py* import test_install_insert def index(): if db(db.auth_permission).isempty() and db(db.auth_membership).isempty(): test_install_insert session.flash = T('Installation Done') redirect(URL('default', 'index') ) *modules/test_install.py* import sys;

[web2py] Re: running web2py module from terminal return AttributeError: 'thread._local' object has no attribute '

2016-07-09 Thread
Thank you so much Anthony, it works well now. Best Regards, stifan -- 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

[web2py] running web2py module from terminal return AttributeError: 'thread._local' object has no attribute '

2016-07-09 Thread
i have web2py modules that insert new data for new web2py app: *modules/test_install.py* #!/usr/bin/env python # coding: utf8 import sys; sys.path.append('site/web2py/') from gluon import current #from gluon import * from gluon.contrib.webclient import WebClient install =

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread
the apps is build from scratch, no created index before either from apps and from database side. the only place i create index is in the controllers/install.py, and it's only execute one time only. my logic during first code install script is : execute create index first then execute insert

[web2py] web2py traceback is not clear to tell the error

2016-07-08 Thread
let say i have a code: *models/db_wizard_1_bank.py* db.define_table('bank', Field('name'), Field('website'), format = '%(name)s') *controllers/install.py* def index(): if db(db.auth_permission).isempty() and db(db.auth_membership).isempty(): # create index : auth_user db.executesql('CREATE

[web2py] insert table twice on same table, the second insert is not work

2016-06-28 Thread
is it possible to insert table twice on same table in web2py? e.g. *modules/test_event.py* def after_insert_event(f, id, table): time_stamp = current.request.now client_ip = current.request.client user_id = current.auth.user_id origin = '%s/%s' % (current.request.controller,

[web2py] Re: The built-in web2py wiki error

2016-06-26 Thread
i think you can download it from web2py website : http://web2py.com/init/default/download trunk is for tester (yellow background) best regard, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Could I specific two different locations for 'include' in layout.html?

2016-06-24 Thread
i think it can do in web2py e.g. *views/default/contact_us.html* {{right_sidebar_enabled = True}} {{block right_sidebar}} {{include 'templates/right_sidebar.html'}} {{end}} {{extend 'layout.html'}} {{include 'templates/form.html'}} best regards, stifan -- Resources: - http://web2py.com -

[web2py] is default value request.now is work in SQLFORM.grid (edit) ?

2016-06-20 Thread
is default value request.now is work in SQLFORM.grid (edit) ? e.g. *models/db.py* def on_define_employee(table): # default table.status.default = 'New' # notnull table.full_name.notnull = True table.status.notnull = True # required table.full_name.required = True table.status.required = True #

[web2py] Re: How to get Month name instead of month number

2016-06-18 Thread
i think you can use python strftime e.g. {{from datetime import date}} {{=SPAN(row.f_start_time.strftime("%b") ) }} *Result : Mar* {{=SPAN(row.f_start_time.strftime("%B") ) }} *Result : March* Best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

Re: [web2py] Re: show map on grid view

2016-06-17 Thread
thanks manuele, i've tried that but the result is same (no error occured but the result is not expected, google maps show almost take the sqlform grid view entirely). e.g. def check_point_admin(row): scr0 = SCRIPT(""" function initMap() { var mapDiv = document.getElementById(%s);

[web2py] grid exportclasses not work in recent version

2016-06-16 Thread
just want to report grid exportclasses is not work in recent version : e.g. def index(): table = db.test exportclasses = dict(csv_with_hidden_cols=False, xml=False, json=False, tsv_with_hidden_cols=False, tsv=False) grid = SQLFORM.smartgrid(table, exportclasses = exportclasses) return locals()

[web2py] Re: how to define DAL in pythonanywhere ????

2016-06-01 Thread
pls try : mysql://pythonuser:MySQLpwd@mysql.server/pythonuser$MySQLdb note : - pythonuser is your pythonanywhere username - MySQLpwd is your MySQL Password in pythonanywhere - MySQLdb is your database mysql that store data for application best regards, stifan -- Resources: - http://web2py.com

[web2py] Re: show map on grid view

2016-05-31 Thread
testing to put it on the SQLFORM.grid links no error occured but the result is not expected e.g. *controllers* def check_point_admin(row): scr0 = SCRIPT(""" function initMap() { var mapDiv = document.getElementById(%s); var latlon = new google.maps.LatLng( %s, %s ); var mapOptions = {

[web2py] show map on grid view

2016-05-27 Thread
let say i have a table definition with latitude and longitude as double, and want to show it in SQLFORM.grid view. is it possible to achieve it using web2py? i've tested it before and an error occured said : Traceback (most recent call last): File

[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2016-05-26 Thread
follow the instruction is working well, thank you, but when i tried to add the condition it didn't work. e.g. *controllers/default.py* *"""* *not work because of this* *def check_condition(): * *auth.settings.login_next = URL('user/profile')* *if request.function != 'user':* *

[web2py] Re: Is auth.settings.login_onfail a documented callback?

2016-05-23 Thread
perhaps an example can speak thousand words : e.g. def login_onfail(form): email = request.vars.email row = db((db.auth_user.email == email ) ).select().first() if row is not None: db.auth_event.insert(time_stamp = request.now, client_ip = request.client, user_id = row.id, origin = '%s/%s' %

[web2py] Re: scheduler use python modules

2016-05-23 Thread
> > Does it work to import locale in the module instead of in the view? > import python module doesn't work in web2py modules, so it must redefine again (e.g. locale, datetime) > > Modules do not get the complete global environment from the model or > controller that calls them > (per

[web2py] Re: scheduler use python modules

2016-05-23 Thread
in web2py book, i think we can put template using response.render in any place in views. *ref:* http://web2py.com/books/default/chapter/29/08/emails-and-sms?search=response.render#Using-the-template-system-to-generate-messages *the evidence fact i got :* - mail() with response.render() that

[web2py] Re: Which free email service works fine with web2py?

2016-05-23 Thread
not sure what do you need, do you mean the smtp service? i think you could use your isp smtp or smtp from your domain hosting. i've seen in the other post that gmail is fine if you don't activate two factor authentification in gmail (lionel point it up, if i'm not mistake) best regards, stifan

[web2py] Re: scheduler use python modules

2016-05-21 Thread
*full traceback got from table scheduler_run :* Traceback (most recent call last): File "/Users/MacBookPro/site/web2py/gluon/scheduler.py", line 313, in executor result = dumps(_function(*args, **vars)) File "applications/mutualfunds/models/scheduler.py", line 14, in

[web2py] scheduler use python modules

2016-05-21 Thread
is scheduler can use python modules? e.g. *models/scheduler.py* def task_mail_investor_monthly_report(): title = 'Mutual Funds Investor Monthly Report' rows_investor = db(db.investor.id > 0).select() for row_investor in rows_investor: query_account = (db.account.investor == row_investor.id)

[web2py] Re: How can I make a calculation in the view?

2016-05-18 Thread
just do like usual in controller e.g. *controllers/default.py* def report_investor(): choose_investor = request.args(0) # query query_account = (db.account.investor == choose_investor) # row rows_account = db(query_account).select(orderby = ~db.account.id) return dict(rows_account =

[web2py] Re: update table and calculate FIFO methods

2016-04-29 Thread
def __after_insert_redemption_detail(f, id): query_unit = db.unit.account == f['account'] row_unit = db(query_unit).select(orderby = ~current.db.unit.id).first() insert_unit_unit = row_unit.unit - f['unit'] if row_unit else f['unit'] insert_unit_previous_unit = row_unit.unit if row_unit else 0

[web2py] Re: update table and calculate FIFO methods

2016-04-28 Thread
pardon, i forgot to include my code i'm done so far with the unexpected result (no error occured) code: def __after_insert_redemption_detail(f, id): query_unit = db.unit.account == f['account'] row_unit = db(query_unit).select(orderby = ~current.db.unit.id).first() db.unit.insert(account =

[web2py] update table and calculate FIFO methods

2016-04-28 Thread
is there a way to update table and calculate using FIFO (First In First Out) methods? e.g. Unit Trade Unit Remaining Subscription Unit NAV Date 3.000,00 1.000,00 1.000,00 01/03/2016 2.000,00 1.000,00 1.000,00 01/02/2016 1.000,00 1.000,00 1.000,00 01/01/2016 let say i have the data above, when

[web2py] Re: list:reference - Input Data

2016-04-28 Thread
please try: db.movies.category.requires = IS_IN_DB(db, 'categories.title', db.categories._format, multiple = True) ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Validators best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

[web2py] Re: Helping with dropdown list using query

2016-04-22 Thread
pls try : db.servicos_feitos.servico_feito.requires = IS_IN_DB(db((db.servico_oficina.id_salao == auth.user_id) & (db.servico_oficina.servico_salao == db.tipo_servicos.id) ), db.servico_oficiona.id, db.servico_oficiona._format) not sure because i don't see db.servico_oficina.id_salao on your

[web2py] Re: strange behaviour in after_insert callback

2016-04-22 Thread
k, got it, thank you so much Anthony for detail explaination. best regards, stifan -- 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

[web2py] Re: Changing color of field

2016-04-21 Thread
another way aroud : db.task.deadline.represent = lambda value, field: SPAN('%s' % (value), _class = 'text-danger' if value > request.now else 'text-success') best regards, stifan On Friday, April 22, 2016 at 6:54:48 AM UTC+7, Michael Beller wrote: > > There are a couple of ways to do this.

[web2py] Re: strange behaviour in after_insert callback

2016-04-21 Thread
at 9:03:16 PM UTC+7, Anthony wrote: > > On Thursday, April 21, 2016 at 1:57:20 AM UTC-4, 黄祥 wrote: >> >> meet strange behaviour in after_insert callback, when using variable >> (e.g. f.amount) is not work, but when using dict (e.g. f['amount'] ) work >> mode

[web2py] Re: deploy to pythonanywhere broken in >= 2.14.x version

2016-04-21 Thread
it isn't...? > > > Giles > > > On Wednesday, April 20, 2016 at 8:53:17 PM UTC+1, 黄祥 wrote: >> >> yes, you all right, it back to normal right now, perhaps about the >> outage, but the same behaviour is still exist : >> >> usually the button show work

[web2py] strange behaviour in after_insert callback

2016-04-20 Thread
meet strange behaviour in after_insert callback, when using variable (e.g. f.amount) is not work, but when using dict (e.g. f['amount'] ) work models/db_wizard_4_subscription.py # not work def __after_insert_subscription_detail(f, id): unit = float(f.amount) / float(f.nav_per_unit) """ # work

[web2py] Re: deploy to pythonanywhere broken in >= 2.14.x version

2016-04-20 Thread
yes, you all right, it back to normal right now, perhaps about the outage, but the same behaviour is still exist : usually the button show working in a couple minutes (depends on the apps deployed), yet in the 2.14.x version, the button show working just in few seconds, yet in the

[web2py] deploy to pythonanywhere broken in >= 2.14.x version

2016-04-19 Thread
just want to report deploy to pythonanywhere is broken in >= 2.14.x version no error traceback occured, yet the result is not expected. usually the button show working in a couple minutes (depends on the apps deployed), yet in the 2.14.x version, the button show working just in few seconds, yet

[web2py] Re: How to compare between two datetime in web2py?

2016-04-18 Thread
perhaps you can use timedelta e.g. due_date = row_sale.trade_date + datetime.timedelta(seconds = 4) if due_date == row_sale.due_date: print '4 seconds' best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source

[web2py] Re: delete on confirmation

2016-04-10 Thread
please try {{=SPAN(A(T('Delete'), _href = URL('delete', args = [id] ), _title = 'Delete', _onclick = "javascript:return confirm('Are you sure you want to process?')", _class = 'to-delete') ) }} best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

[web2py] Re: How to make markin2html work in web2py?

2016-04-07 Thread
if you want the pdf, please check the book : http://web2py.com/books/default/chapter/29/10/services#ReportLab-and-PDF best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: In the dropdown here how to remove Profile?

2016-03-28 Thread
pardon, not sure what do you mean with 'add extra fields to the dropdown table' best regards, stifan -- 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) ---

[web2py] Re: sidebar

2016-03-27 Thread
pls try in your view : {{right_sidebar_enabled = True}} {{block right_sidebar}} {{include 'default/right_sidebar.html'}} {{end}} {{extend 'layout.html'}} best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source

[web2py] Re: In the dropdown here how to remove Profile?

2016-03-27 Thread
in models : auth.settings.actions_disabled = ['profile'] custom_auth_table = db[auth.settings.table_user_name] custom_auth_table.first_name.readable = False custom_auth_table.last_name.readable = False custom_auth_table.first_name.writable = False custom_auth_table.last_name. writable = False

[web2py] Re: web2py 2.14.1 is OUT

2016-03-24 Thread
not sure enough about the boolean configuration in appconfig. just tested it but return an error traceback, e.g. *appconfig.ini* [smtp] ssl= true *db.py* auth.settings.create_user_groups = myconf.get('smtp.ssl') *traceback error* TypeError: unsupported operand type(s) for %: 'bool' and

[web2py] Re: web2py 2.14.1 is OUT

2016-03-24 Thread
target locked, the culprit is : *in old version :* response.form_label_separator = myconf.get('forms.separator') *in current version : * response.form_label_separator = myconf.get('forms.separator') or '' *effect :* when using old version conf in current version web2py, in form field the name is

[web2py] Re: web2py 2.14.1 is OUT

2016-03-24 Thread
pictures means thousand words, in previous version 2.13.x the same code doesnt have None in every form field, i guess the root cause is in T() but not sure because I never Translate for Id yet the result is same IdNone (please see attached files), the expected is without None : Id thanks and

[web2py] Re: web2py 2.14.1 is OUT

2016-03-24 Thread
i realize the sqlform(), sqlform.grid() and sqlform.factory() is behave strangely, the form field is added with None, e.g. NameNone is there a way to fix this? thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: web2py 2.14.1 is OUT

2016-03-24 Thread
the new configuration surely is different from previous one, i have some question about it (appconfig.ini and db.py) 1. myconf.get() instead of myconf.take() is there any difference or the old one is drop? 2. pool_size = myconf.get('db.pool_size'), i learned from anthony in the old version it

[web2py] Re: modal not work when upload form field have the data

2016-03-18 Thread
thanks all, i've tried both but got unexpected result (no error occured) *- iframe* : the other modal is loaded too status loading ... (because i have a modal that have a modal on it (modal raw material have another modal name modal category) ) *code*

[web2py] modal not work when upload form field have the data

2016-03-15 Thread
is it possible to make modal work when upload form field have the data? i've tested before the form submit button only show working... (no error traceback occured but the result is not expected) *my code :* *controlelrs/transaction_purchase.py* def modal_raw_material(): form =

[web2py] Re: DAL: reference to FK-field causes an error

2016-03-12 Thread
pls try : db.define_table('b_tbl', Field('a_tbl_id', 'reference a_tbl') ,Field('name') ) db.define_table('c_tbl', Field('b_tbl_id', 'reference b_tbl') ,Field('name') ) i think in b_tbl, field id is already there as the integer auto increment primary key, so when you redefine another field with

[web2py] Re: add value to dropdown list

2016-03-05 Thread
it's hard to tell without seeing the code in your models, dropdown list in form usually come either you set the table field reference to another table or you set the table field as string and have validation requires IS_IN_SET() if the table field is reference to another table, it's simply just

[web2py] Re: web2py included on Synology DSM

2016-02-10 Thread
done -- 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

[web2py] default value condition base on time

2016-02-09 Thread
is it possible to have default value condition base on time? i tried before but return an error e.g. 1 table.shift.default = 1 if request.now.hour() >= 0 & request.now.hour() <= 8 else 2 if request.now.hour() >= 8 & request.now.hour() <= 16 else 3 TypeError: 'int' object is not callable e.g. 2

[web2py] Re: default value condition base on time

2016-02-09 Thread
thank you so much dave it work perfectly e.g. table.shift.default = 1 if request.now.hour >= 0 & request.now.hour <=8 else 2 if request.now.hour >= 8 & request.now.hour <=16 else 3 thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: ajax callback onchange for checkbox boolean

2016-02-07 Thread
found the solution with redirect(current.request.env.http_web2py_component_location, client_side = True), never thought that more than one check box must reload the whole page to ensure the value is store in the session, it's so different with the form field text input type, doesn't matter how

[web2py] Re: ajax callback onchange for checkbox boolean

2016-02-06 Thread
why when using 2 checkbox, the latest change or click is applied, the previous one is ignore to store in the session value? let say, i have two unchecked checkbox name : bevel and gosok_halus, when i click for all checkbox, first : bevel and then second click : gosok_halus, the value that been

[web2py] Re: store boolean data type in session, always return true during insert

2016-02-06 Thread
True if gosok_halus == > 'on' else False)* > > Anthony > > On Saturday, February 6, 2016 at 2:16:56 AM UTC-5, 黄祥 wrote: >> >> why during store boolean data type in session, always return true during >> insert? >> e.g. problem >> for counter, (i

[web2py] store boolean data type in session, always return true during insert

2016-02-05 Thread
why during store boolean data type in session, always return true during insert? e.g. problem for counter, (id, quantity, length_in_cm, width_in_cm, total_square_meter, *bevel, gosok_halus*) in session.delivery_order_detail.items(): db.delivery_order_detail.insert(delivery_order_no =

[web2py] ajax callback onchange for checkbox boolean

2016-02-01 Thread
just wondering about ajax callback onchange for checkbox boolean e.g. *modules* if current.request.vars.action == 'adjust_factory': * #factory = current.request.vars['factory_%s' % id]* *factory = current.request.vars.factory* if factory == 'on': factory = 'None' session_order_product[id] =

[web2py] Re: Probably very naive question from new user

2016-01-31 Thread
perhaps you can learn a lot from web2py appliances or web2py slices : http://www.web2py.com/appliances http://www.web2pyslices.com best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: compute and after_insert callback on table

2016-01-24 Thread
my exact code : def on_define_default_size(table): # compute #table.total_square_meter.compute = lambda r: (float(r['length_in_cm'] ) * float(r['width_in_cm'] ) ) / 1 # label table.name.label = T('Name') table.length_in_cm.label = T('Length in Cm') table.width_in_cm.label = T('Width in Cm')

[web2py] Re: compute and after_insert callback on table

2016-01-23 Thread
still face the same error : e.g. db.define_table('default_size', Field('name'), Field('length_in_cm', 'double'), Field('width_in_cm', 'double'), Field('total_square_meter', 'double'), Field('acquisition_price', 'integer') ) db.default_size.total_square_meter.compute = lambda r:

Re: [web2py] Re: django type adding or append fields using plus sign to your table

2016-01-18 Thread
just wondering why the requires list in a list type [] is not work properly when update (when insert goes fine): e.g. table.email.requires = IS_LIST_OF([IS_LOWER(), IS_EMAIL(), *IS_NOT_IN_DB(db, table.email)* ] ) the problem when update is validator IS_NOT_IN_DB() is always true Value already

[web2py] Re: websockets

2016-01-17 Thread
i've followed the steps but end it with an error occured : *running run_iochat.py from terminal* (site)MacBook:~ MacBookPro$ python ~/site/web2py/run_iochat.py Traceback (most recent call last): File "/Users/MacBookPro/site/web2py/run_iochat.py", line 8, in from gluon.main import

[web2py] Re: update 2 session value using module only first session value work

2016-01-15 Thread
, no error traceback occured, but the result is not expected (check with response.toolbar() the value is still 0 ) i know i missed something but can't figure it out, any idea how to face this using web2py way? thanks and best regards, stifan On Thursday, January 14, 2016 at 7:03:43 AM UTC+7, 黄祥 wrote

[web2py] Re: update 2 session value using module only first session value work

2016-01-15 Thread
= 0) right now the second parameter in module can work with the variable (not directly explicit the session name) best regards, stifan On Friday, January 15, 2016 at 4:07:48 PM UTC+7, 黄祥 wrote: > > the previous is not work, it's work first because it still store the > previous sessi

[web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread
i think you can use format or represent to achieve it. e.g. *somewhere in models after you define auth tables* custom_auth_table = db[auth.settings.table_user_name] custom_auth_table._format = '%(first_name)s %(last_name)s' *controllers that have SQLFORM.factory that refer to auth_user table*

[web2py] Re: update 2 session value using module only first session value work

2016-01-13 Thread
> then pass in the session object and do: > > session.sale_order_net = ... > > Anthony > > > > > > On Wednesday, January 13, 2016 at 12:48:11 AM UTC-5, 黄祥 wrote: >> >> is it possible to update 2 sessions values using web2py module? i've >> tested it only first

[web2py] update 2 session value using module only first session value work

2016-01-12 Thread
is it possible to update 2 sessions values using web2py module? i've tested it only first session value work, the second session value work if explicit define in the module (but the module is used by another controller, so i want to create just 1 module for all controllers). e.g.

[web2py] Re: How to know the IP address of the user client using my web2py site?

2016-01-12 Thread
i think you can use request.client e.g. def oncreate_event(form, table): db.auth_event.insert(time_stamp = request.now, *client_ip = request.client*, user_id = auth.user_id, origin = '%s/%s' % (request.controller, request.function), description = 'ID %s created in table %s' % (form.vars.id,

[web2py] Re: How to know the location of the user client on my site?

2016-01-12 Thread
i think you can achieve it with datetime.timedelta and set the default value of your table with that value. e.g. import datetime table.end_time.default = request.now + datetime.timedelta(seconds = 19200) p.s. 19200 seconds is 5 hours and 20 minutes best regards, stifan -- Resources: -

[web2py] Re: import a database into web2py

2016-01-06 Thread
there is a script included in the web2py package in folder scripts (extract_db_models.py) db is refer to mysql, oracle, pgsql, sqlite. doesn't know if the adrien python script is same or not like the included one. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: View To Controller, HTML componets

2016-01-06 Thread
perhaps this link can help you : http://web2py.com/books/default/chapter/29/05/the-views#INPUT http://web2py.com/books/default/chapter/29/07/forms-and-validators#FORM best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Simple left sidebar example

2016-01-05 Thread
not sure which part you didn't understand from the manual book, pls try this : *views_that_have_left_sidebar.html* {{left_sidebar_enabled = True}} {{block left_sidebar}} {{include 'templates/cart/cart_sidebar.html'}} {{end}} {{extend 'layout.html'}} *views/templates/cart/cart_sidebar.html*

[web2py] temporary store the uploaded file in session

2015-12-17 Thread
hi, is it possible to temporary store the uploaded file in session? e.g. import os def form_1(session_order, link_form, link_checkout): form = SQLFORM.factory( Field('detail_account', 'reference detail_account', requires = IS_IN_DB(current.db, current.db.detail_account.id,

[web2py] Re: How do I not show particular fields for the user to fill while signing up and make them fill later?

2015-12-16 Thread
just an idea that got from a lot website, is they have separate table for that, let say for login user it store in auth_user and then they build another table let say profile that contain additional information about the user, like : phone, address, hobby, etc and refer the table to the logged

[web2py] Re: How does auth.signature work? deletion of inactive records

2015-12-09 Thread
i think you can use on delete database callback to execute sql syntax to delete the inactive record. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list

[web2py] Re: how to remove quotation marks and parens from session.flash vars?

2015-12-07 Thread
pardon, i'm don't understand what you want to achieve, i guess is e.g. the text you want to achieve Remove them from your blocked list first! Megan Smith ! if is it i think you can achieve it with : e.g. of code session.flash = T('Remove them from your blocked list first! %s %s !') %

[web2py] Re: Manage users

2015-12-07 Thread
i think you can create your own controller for it e.g. controllers/admin.py def user(): table = db.auth_user grid = SQLFORM.grid(table) return locals() # group def group(): table = db.auth_group grid = SQLFORM.grid(table) return locals() # membership def membership(): table = db.auth_membership

[web2py] Re: How to embed uploaded PDF?

2015-12-05 Thread
please take a look at this discussion : https://groups.google.com/forum/#!topic/web2py/EXYT8U_Ws0M best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list

[web2py] Re: multiple conditionals possible in grid formatting statements?

2015-12-04 Thread
pardon, i'm a little bit confuse with your code, i think you can create the links in grid with the a href, and then put the represent for coloring it's font via dal represent e.g. not tested table_status = {True, False} db.table.is_active.represent = lambda is_active, field:

[web2py] Re: how to make links conditional in grid

2015-12-01 Thread
sorry, my bad, thank you so much for the correction, anthony best regards, stifan On Wednesday, December 2, 2015 at 2:32:10 AM UTC+7, Anthony wrote: > > On Monday, November 30, 2015 at 8:19:09 PM UTC-5, Alex Glaros wrote: >> >> what is syntax for making links conditional in grid? >> >> I only

[web2py] Re: form validation using onvalidation and form.validate for boolean data type

2015-12-01 Thread
processing, you can do: > > if form.vars.is_booking: > > Anthony > > On Monday, November 30, 2015 at 8:33:31 PM UTC-5, 黄祥 wrote: >> >> the error traceback is say about the field customer is empty, so i >> encountered it with IS_EMPTY_OR(IS_IN_DB() ) form validatio

[web2py] Re: Seeing SQL Create Statements

2015-12-01 Thread
there is sql.log file in databases folder of your applications, or you can simply looking in the appadmin as well (near models) best regards, stifan On Wednesday, December 2, 2015 at 6:37:12 AM UTC+7, Rob N wrote: > > Hi all, > > I'm looking for a way to be able to see all the SQL create

[web2py] Re: how to make links conditional in grid

2015-11-30 Thread
please try : if db.auth_membership.is_active == True: links = [...] else: links = None best regards, stifan -- 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)

[web2py] Re: form validation using onvalidation and form.validate for boolean data type

2015-11-30 Thread
the error traceback is say about the field customer is empty, so i encountered it with IS_EMPTY_OR(IS_IN_DB() ) form validation. but it's not the main problem, the main problem is when using form.validate() it seems that boolean field type always return false answer even i already tick mark

[web2py] form validation using onvalidation and form.validate for boolean data type

2015-11-29 Thread
is there any differences when form validation using onvalidation and form.validate for boolean data type? *example 1 work when using onvalidation* # onvalidation_check_in *def __onvalidation_check_in(form):* * if form.vars.is_booking == 'on':* if form.vars.booking_no: rows = db(db.booking.id ==

[web2py] Re: auth new user registration even after login

2015-11-23 Thread
i guess you have set : step 1 : auth.settings.actions_disabled = ['register'] step 2 set the callback : def __after_insert_auth_user(f, id): row = db(db.auth_user.id == id).select().first() mail.send(mail.email, 'Login credential', 'Email : %s, Password : password' % (mail.email) )

[web2py] Re: Using orderby in IS_IN_DB with a foreign key.

2015-11-21 Thread
yes you are right, thanks for corrected me best regards, stifan On Sunday, November 22, 2015 at 2:24:53 AM UTC+7, Anthony wrote: > > On Saturday, November 21, 2015 at 2:19:02 PM UTC-5, 黄祥 wrote: >> >> please try : >> IS_IN_DB(db, db.auth_user.id, db.au

[web2py] Re: Using orderby in IS_IN_DB with a foreign key.

2015-11-21 Thread
please try : IS_IN_DB(db, db.auth_user.id, db.auth_user._format, orderby = db.auth_user.first_name) if not work, perhaps you modif your auth_user table (first_name field into something else) best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread
tested it. return an error if i put the value int = 1 as true in appconfig.ini e.g. privates/appconfig.ini [auth] create_user_groups = 0 ; return an error traceback when value = 1, when value = 0, no error occured, works as expected models/db.py auth.settings.create_user_groups =

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread
are passing in the string > 'auth.create_user_groups' and not auth.create_user_groups as a variable? > > > > On Thu, Nov 19, 2015 at 9:32 PM, 黄祥 <steve.van...@gmail.com > > wrote: > >> tested it. return an error if i put the value int = 1 as true in >> appco

[web2py] Re: How to control the access with auth_group?

2015-11-19 Thread
i think you can use conditional check auth.has_membership, either put it on models/menu.py, controllers or even in views e.g. if auth.has_membership(role = 'Admin'): best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: How to cope with schema changes on Prod

2015-11-16 Thread
just an idea, why not use configuration management software like puppet, chef, etc? you can set the web2py file configuration, and push it according to your setting environment (QA, Stage, Prod). best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Dynamic addition of name-value pairs using SQLFORM or CRUD

2015-11-13 Thread
i think you are in the right track, please try to fill the cell phones table with some record, then access the config table, you can see the cell phone field can be choosen more than 1 value (press shift). best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: new connection string in scaffold

2015-11-13 Thread
please take a look at appconfig.ini file in private folder and change the uri value with your own settings : e.g. private/appconfig.ini [db] uri = mysql://MySQLUser:MySQLPassword@MySQLHost/MySQLDatabase best regards, stifan > -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Why there is a blank option in drop-down and how to avoid it?

2015-11-13 Thread
i think you can use zero parameter in IS_IN_SET() validators. ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Range--set-and-equality-validators best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

<    4   5   6   7   8   9   10   11   12   13   >