[web2py] Re: Error after edit project

2019-03-18 Thread Константин Комков
It proceeds for two week in last day of week I see that error, but I know 
that code don't have errors, then in Monday I open app for test and all 
work!
Today it is work again, but in Saturday I have saw error not only on server 
but and if I was usual user. I need to edd that I cleared cache on server 
and on my computer and restart server and my computer nothing don't solve 
that problem.
Maybe fastcgi or anything else don't work stability? Maybe it contain with 
server loading?
Very much actions are coming in that function:
1. Server create letter
2. Server send letter for user with attachments (4 or more each file < 10 
Mb)
3. Server send letter for operator with attachments (4 or more each file < 
10 Mb)
4. Server make 14 query to database
5. Server create XML (75 strings)
After user send button waiting time 10-30 seconds.

-- 
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: Filtering through a selected group of entities with a search function

2019-03-18 Thread Константин Комков
Did you write that in db.py?

session .connect(request 
, response 
, db_app, masterapp=None)



-- 
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: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-18 Thread João Matos
This is valid Python code.

table and rec_id are defined in the on_delete function arguments (it's the 
function used in the ondelete argument of a grid).

def on_delete(table: pydal.objects.Table, rec_id: str):


row is the variable name.

pydal.objects.Row is the variable type.

I'm using Python 3.7.1 and using Python typing.

What I'm doing is reading a single record passed by the grid's ondelete.

pydal is not auto imported by web2py when the function is defined, but it 
is auto imported by web2py when the function runs, because If I remove the 
typing from the function header, but keep the typing from the function 
body, everything works.

My question is if this is web2py correct behavior (pydal is not auto 
imported by web2py when the function is defined, but it is auto imported by 
web2py when the function runs).



segunda-feira, 18 de Março de 2019 às 02:42:09 UTC, Massimo Di Pierro 
escreveu:
>
> I do not understand. this:
>
> row: pydal.objects.Row = table[rec_id]
>
>
> is not a valid Python code. Also, as you say pydal is not imported. 
> Moreover Row is an internal class, you should not try redefine it.
> Can you explain what you are trying to achieve? Maybe there is a better 
> way.
>
> On Friday, 8 March 2019 09:12:21 UTC-8, João Matos wrote:
>>
>> Didn't know that, will correct auth.requires_login with auth.is_logged_in.
>>
>> No I did not import pydal.
>>
>> If I remove the type specification from the function header it works, 
>> even when I'm also mentioning pydal inside the function in the line
>>
>>  row: pydal.objects.Row = table[rec_id]
>> which means pydal is imported by web2py.
>>
>>
>>
>>
>> sexta-feira, 8 de Março de 2019 às 17:06:38 UTC, Leonel Câmara escreveu:
>>>
>>> Note that requires_login is meant to be used as a decorator, you should 
>>> be using auth.is_logged_in() 
>>>
>>> Did you import pydal?
>>>
>>

-- 
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.


Re: [web2py] Re: Web3py reboot

2019-03-18 Thread Kevin Keller
Well, if you want to have something different, we would probably need to
look into things like scaffolding of a web3py REST backend with oauth2+jwt
security for the endpoints plus automatic openapi (swagger)
documentation/files and a frontend based i,.e. on Vue.js or React/Angular.
Somewhat similiar to JHipster.
I suppose the decoupling of frontend javasript and backend python code is
where the development of web pages is headed.
That would also enable easy to create mobile applications with a web2py
backend.

Other ideas are of course to develop the low code approach further, to have
something like Oracle APEX https://apex.oracle.com/en/ or
https://anvil.works/, which is a low code environment purely based on
python
including the frontend.
While it uses sculpt which is only python2 comptabile, we could look and
transcrypt if we had a visual environment were poeple can drag and drop
elements and code their behaviour in python via transcrypt.
https://www.transcrypt.org/

So I dont know where you thoughts were headed, but it is towards the
future, then these are my 2 cents.
Possibly low hanging fruit is to focus on easy REST API with automatic
openapi documentation and then go from there.

But if we are there, I suppose we are already at Web4Py, which is even a
better sounding name.

Web3Py, just to regain more popularity, but making it clear that web2py is
fully python3 compatible and increase stability by further code reviews by
more coders would be a good first step I thought.





On Mon, Mar 18, 2019 at 3:47 AM Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I think web3py should be something a little different, not just web2py for
> python3.
>
>
>
> On Sunday, 17 March 2019 05:42:16 UTC-7, Kevin Keller wrote:
>>
>> Hey,
>>
>> So I was wondering today what you guys would think about the idea to
>> rename web2py to Web3py, once it reaches a level of maturity that would be
>> able to justify the rename and a reboot.
>>
>> That would also mean to update the web page and various resources.
>>
>> The reason is simple :
>>
>> It seems that since  around 2016 python 3 has seen a major increase in
>> adoption while web2py adoption decreased due to being perceived as python2
>> only framework, which at the time was certainly true.
>>
>> While it's not true anymore, I think the perception of being a python2
>> only framework combined with outdated resources doesn't help adoption.
>>
>> While sacrificing the established name is certainly not great, I think
>> the benefits of a reboot with a name change to emphasize the python3
>> compatibility would far outweigh any drawback.
>> Python2 compatibility that is maintained would however seen as a plus and
>> a major differentiator to other frameworks that dropped python2 support.
>>
>> What do you think?
>>
>> --
> 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.
>

-- 
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.


Re: [web2py] Re: Web3py reboot

2019-03-18 Thread Kevin Keller
Just for reference: https://www.jhipster.tech/

On Mon, Mar 18, 2019 at 9:59 AM Kevin Keller  wrote:

> Well, if you want to have something different, we would probably need to
> look into things like scaffolding of a web3py REST backend with oauth2+jwt
> security for the endpoints plus automatic openapi (swagger)
> documentation/files and a frontend based i,.e. on Vue.js or React/Angular.
> Somewhat similiar to JHipster.
> I suppose the decoupling of frontend javasript and backend python code is
> where the development of web pages is headed.
> That would also enable easy to create mobile applications with a web2py
> backend.
>
> Other ideas are of course to develop the low code approach further, to
> have something like Oracle APEX https://apex.oracle.com/en/ or
> https://anvil.works/, which is a low code environment purely based on
> python
> including the frontend.
> While it uses sculpt which is only python2 comptabile, we could look and
> transcrypt if we had a visual environment were poeple can drag and drop
> elements and code their behaviour in python via transcrypt.
> https://www.transcrypt.org/
>
> So I dont know where you thoughts were headed, but it is towards the
> future, then these are my 2 cents.
> Possibly low hanging fruit is to focus on easy REST API with automatic
> openapi documentation and then go from there.
>
> But if we are there, I suppose we are already at Web4Py, which is even a
> better sounding name.
>
> Web3Py, just to regain more popularity, but making it clear that web2py is
> fully python3 compatible and increase stability by further code reviews by
> more coders would be a good first step I thought.
>
>
>
>
>
> On Mon, Mar 18, 2019 at 3:47 AM Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> I think web3py should be something a little different, not just web2py
>> for python3.
>>
>>
>>
>> On Sunday, 17 March 2019 05:42:16 UTC-7, Kevin Keller wrote:
>>>
>>> Hey,
>>>
>>> So I was wondering today what you guys would think about the idea to
>>> rename web2py to Web3py, once it reaches a level of maturity that would be
>>> able to justify the rename and a reboot.
>>>
>>> That would also mean to update the web page and various resources.
>>>
>>> The reason is simple :
>>>
>>> It seems that since  around 2016 python 3 has seen a major increase in
>>> adoption while web2py adoption decreased due to being perceived as python2
>>> only framework, which at the time was certainly true.
>>>
>>> While it's not true anymore, I think the perception of being a python2
>>> only framework combined with outdated resources doesn't help adoption.
>>>
>>> While sacrificing the established name is certainly not great, I think
>>> the benefits of a reboot with a name change to emphasize the python3
>>> compatibility would far outweigh any drawback.
>>> Python2 compatibility that is maintained would however seen as a plus
>>> and a major differentiator to other frameworks that dropped python2
>>> support.
>>>
>>> What do you think?
>>>
>>> --
>> 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.
>>
>

-- 
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: Filtering through a selected group of entities with a search function

2019-03-18 Thread mostwanted
Thanks for that assistance on sessions *@ *Константин Комков,  

On Monday, March 18, 2019 at 9:46:14 AM UTC+2, Константин Комков wrote:
>
> Did you write that in db.py?
>
> session .connect(request 
> , response 
> , db_app, masterapp=None)
>
> It's how I use sessions in form:
>
> form = FORM(
> SELECT (
> [rec.NAME for rec in 
> db(db.s_graduation_types).select(db.s_graduation_types.NAME)],
> _class='form-control',
> value=session 
> .edu_grad_type if session 
> .edu_grad_type else '',
> _name='grad_type',
> _id='eduType'
> )
> )
>
>
> *if form.process(formname='form',onvalidation=edu_validation).accepted:   
>  session.edu_grad_type = form.vars.grad_type
> redirect(URL('bak','select_cg'))*
>
> After end work with session I clear it:
>
> session .edu_grad_type = 
> None
>
>
>
>

-- 
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: Error accessing app edit

2019-03-18 Thread Leonel Câmara
This was due to changes I made to the way web2py discovers exposed 
functions in a controller file. It uses the python parser so it has a 
problem with syntax errors. I made a pull request that teaches the admin to 
deal with them:

https://github.com/web2py/web2py/pull/2151

-- 
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] Grid's selectable checkboxes don't appear in Google Chrome (they appear in IE and Firefox).

2019-03-18 Thread João Matos
Grid's selectable checkboxes don't appear in Google Chrome (they appear in 
IE and Firefox).

Windows 7 Pro x64 SP1+all updates
Python 3.7.1 x86
web2py 2.18.4

Firefox 65.0.2 x64
IE 11
Google Chrome 73.0.3683.75 (Official Build) (64-bit)

-- 
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: Web2py install script python 3/Apache/Ubuntu

2019-03-18 Thread Jim S
+1 to what Massimo said

On Sunday, March 17, 2019 at 9:43:58 PM UTC-5, Massimo Di Pierro wrote:
>
> In 2019 I really do not feel recommending using Apache to anybody. nginx 
> has clearly won this battle.
>
> On Sunday, 17 March 2019 19:35:55 UTC-7, gertk wrote:
>>
>> apt-get install libapache2-mod-wsgi-py3
>>
>> laupäev, 16. märts 2019 15:34.22 UTC+2 kirjutas Mamisoa Andriantafika:
>>>
>>> This script works with python 3 but is under nginx:
>>>
>>>
>>> https://raw.githubusercontent.com/arisobel/web2py_scripts/master/setup-web2py-nginx-p3-uwsgi-ubuntu.sh
>>>
>>>
>>>
>>> Le samedi 16 mars 2019 13:12:06 UTC+1, Mamisoa Andriantafika a écrit :

 Sorry this does not work for me.

 Did you manage to get a server working with python 3 and apache?

 Le samedi 16 mars 2019 12:37:02 UTC+1, 黄祥 a écrit :
>
> think on line 164 and 165 is the culprit, should be
> sudo -u www-data *python3* -c "from gluon.widget import console; 
> console();"
> sudo -u www-data *python3* -c "from gluon.main import save_password; 
> save_password(raw_input('admin password: '),443)"
>
> 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 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] web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-18 Thread João Matos
After installing a compiled app, web2py returns an ImportError that can't 
find the module, but the .pyc file is in the modules\__pycache__ dir.

The compiled app doesn't transport the module\general.py (which is correct) 
but it includes th __pycache__\*.pyc (which is also correct). 
The problem seems to be that web2py doesn't search for the .pyc file inside 
the __pycache__ or that it doesn't recognize the naming used.

My module is called general.py and the .pyc file inside __pycache__ is 
called (automatically by Python) general.cpython-37.pyc.

Windows 7 Pro x64 SP1+all updates
web2py 2.18.4
Python 3.7.1 x86
Firefox 65.0.2 x64

-- 
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: selecting with IS_IN_DB()

2019-03-18 Thread Dave S


On Saturday, March 16, 2019 at 2:18:03 AM UTC-7, mostwanted wrote:
>
>
> Hi guys, i am trying out the IS_IN_DB() validator for the first time, in 
> my research i cant really find out what i am looking for so i was hoping 
> someone with better understanding would assist me. I have 2 tables, one for 
> locations and the other for people and where they come from, I have created 
> a drop down menu from the locations table using the IS_IN_DB() validator, 
> initially the index page displays the drop down list locations and all the 
> registered people, what i want is that when one selects a location from the 
> drop down i should have only the people from that location now displayed, 
> not everyone like initially.
>
> *MODEL CODE:*
>
>
>
>
>
>
>
>
>
>
> *db.define_table('locations',Field('name'),
> format='%(name)s')db.define_table('people',Field('name'),  
>   Field('surname'),Field('home', 'reference 
> locations'))CONTROLLER CODE:*
> def index():
> people=db().select(db.people.ALL)
> location=db().select(db.locations.ALL)
> form=SQLFORM.factory(Field('city', requires=IS_IN_DB(db, 'locations.id
> ', '%(name)s',zero='--Select a location--'), label=SPAN('', 
> _style="font-weight: 
> bold;")))
>
> *VIEW CODE:*
>
>
>
>
>
>
>
>
>
>
>
>
>
> *{{extend 'layout.html'}}SELECT LOCATION{{=form}} />{{for people in people:}}PERSON DETAILSPerson: {{=people.name}} 
> {{=people.surname}}Location: {{=people.home.name}}{{pass}}*
>
> This is a s far as i can go! If the drop down list form IS_IN_DB() 
> validator was like a link i would know what do but its not. Please help me.
>

Why would it be a link?   It's a pass/fail check, as "validator" suggests.

 I think you may find some help in this other thread:
https://groups.google.com/d/msg/web2py/K7PWmfCD6Gk/cMAivRElBwAJ>
but it's doing something different than just being a validator.

/dps

-- 
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.


Re: [web2py] Re: request.requires_https() Python 3 bug

2019-03-18 Thread Yi Liu
Thanks, Lovedie. I already took the risk and tried 2.18.4 locally, not 
convinced to upgrade. I will stay with 2.17.2 for now.

On Friday, March 15, 2019 at 8:16:02 PM UTC-7, Lovedie JC wrote:
>
> You could backup the web2py folder, the try the new web2py 2.18.4 then 
> revert in case it doesn't work.
> Life is about taking risks. 
> Regards 
>
> On Sat, 16 Mar 2019, 01:08 Yi Liu > wrote:
>
>> Thanks for replying. Sorry, Massimo, I am reluctant to upgrade on my 
>> server. I experience a major bug on my local web2py with 2.18 series, re: 
>> Logger 
>> message  
>> error.
>>
>> I have decided to stay with 2.17.2 for now, on both local and server.
>>
>> On Thursday, March 14, 2019 at 8:51:04 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> can you please try 2.18.4?
>>>
>>> On Monday, 11 March 2019 18:16:25 UTC-7, Yi Liu wrote:

 I think this is a python 3 bug:

 I have 

 request.requires_https()

 in a model file 1_server.py

 Then after I switch to Py3 recently, I start to collect these errors:

 Ticket ID

 221.2.44.75.2019-03-10.23-16-34.b272289e-a41d-4c91-a730-2346995d4bdb

  write() argument must be str, not bytes
 Version  
 web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
 Python Python 3.7.1: /usr/local/pyenv/versions/miniconda3-latest/bin/uwsgi 
 (prefix: /usr/local/pyenv/versions/miniconda3-latest)

 Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.

 Traceback (most recent call last):
   File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
 exec(ccode, environment)
   File 
 "/home/www-data/web2py/applications/trialert/compiled/models.1_server.py", 
 line 2, in 
   File "/home/www-data/web2py/gluon/globals.py", line 366, in 
 requires_https
 redirect(URL(scheme='https', args=self.args, vars=self.vars))
   File "/home/www-data/web2py/gluon/globals.py", line 316, in vars
 self.parse_all_vars()
   File "/home/www-data/web2py/gluon/globals.py", line 287, in 
 parse_all_vars
 for key, value in iteritems(self.post_vars):
   File "/home/www-data/web2py/gluon/globals.py", line 308, in post_vars
 self.parse_post_vars()
   File "/home/www-data/web2py/gluon/globals.py", line 244, in 
 parse_post_vars
 dpost = cgi.FieldStorage(fp=body, environ=env, keep_blank_values=1)
   File "/usr/local/pyenv/versions/miniconda3-latest/lib/python3.7/cgi.py", 
 line 486, in __init__
 self.read_single()
   File "/usr/local/pyenv/versions/miniconda3-latest/lib/python3.7/cgi.py", 
 line 665, in read_single
 self.read_binary()
   File "/usr/local/pyenv/versions/miniconda3-latest/lib/python3.7/cgi.py", 
 line 687, in read_binary
 self.file.write(data)
 TypeError: write() argument must be str, not bytes


 TypeError(write() argument must be str, not bytes)
   


 -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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: selecting with IS_IN_DB()

2019-03-18 Thread mostwanted
Thank you Dave S, i figured the IS_IN_DB() approach wouldn't be the best 
solution, i went with another approach which has me stuck too, when you 
have time please look at it & see how you can help me
* https://groups.google.com/forum/#!topic/web2py/MeQEA9vB-Vc 
*

Mostwanted


On Monday, March 18, 2019 at 11:04:52 PM UTC+2, Dave S wrote:
>
>
>
> On Saturday, March 16, 2019 at 2:18:03 AM UTC-7, mostwanted wrote:
>>
>>
>> Hi guys, i am trying out the IS_IN_DB() validator for the first time, in 
>> my research i cant really find out what i am looking for so i was hoping 
>> someone with better understanding would assist me. I have 2 tables, one for 
>> locations and the other for people and where they come from, I have created 
>> a drop down menu from the locations table using the IS_IN_DB() validator, 
>> initially the index page displays the drop down list locations and all the 
>> registered people, what i want is that when one selects a location from the 
>> drop down i should have only the people from that location now displayed, 
>> not everyone like initially.
>>
>> *MODEL CODE:*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *db.define_table('locations',Field('name'),  
>>   format='%(name)s')db.define_table('people',
>> Field('name'),Field('surname'),
>> Field('home', 'reference locations'))CONTROLLER CODE:*
>> def index():
>> people=db().select(db.people.ALL)
>> location=db().select(db.locations.ALL)
>> form=SQLFORM.factory(Field('city', requires=IS_IN_DB(db, '
>> locations.id', '%(name)s',zero='--Select a location--'), label=SPAN('', 
>> _style="font-weight: bold;")))
>>
>> *VIEW CODE:*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *{{extend 'layout.html'}}SELECT LOCATION{{=form}}> />{{for people in people:}}PERSON DETAILSPerson: {{=people.name}} 
>> {{=people.surname}}Location: {{=people.home.name}}{{pass}}*
>>
>> This is a s far as i can go! If the drop down list form IS_IN_DB() 
>> validator was like a link i would know what do but its not. Please help me.
>>
>
> Why would it be a link?   It's a pass/fail check, as "validator" suggests.
>
>  I think you may find some help in this other thread:
> https://groups.google.com/d/msg/web2py/K7PWmfCD6Gk/cMAivRElBwAJ>
> but it's doing something different than just being a validator.
>
> /dps
>
>

-- 
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.