[web2py] Re: conditional requirements

2018-09-17 Thread Massimo Di Pierro
The problem is that you have to populate the next field with ajax based on 
the valued of the previous files. This is async and you need to decide how 
to handle errors, waiting, edits, etc. You are better off doing your own 
form with vue js.

On Sunday, 16 September 2018 11:01:15 UTC-7, Diego Tostes wrote:
>
> Hi,
>
> i was reading about conditional fields (
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
> )
>
> and i have a question.
>
> is it possible to do it as a table definition?
>
> bellow are my table definition:
>
> Adverts = db.define_table('adverts', 
>Field('owner_id', 'integer'),
>Field('type_id', 'integer'),
>Field('description', 'text'),
>Field('image', 'upload'),
>Field('city_id', 'integer'),
>Field('zone_id', 'integer'),
>  )
>
> Adverts_Type = db.define_table('adverts_type', 
>Field('label', 'string'),
>Field('description', 'text'),
>  )
>
> Cities = db.define_table('cities', 
>Field('label', 'string'),
>  )
>
> Zones = db.define_table('zones', 
>Field('city_id', 'integer'),
>Field('label', 'string'),
>  )
>
> Adverts.type_id.requires = IS_IN_DB(db(Adverts_Type), 'adverts_type.id', 
> '%(label)s')
> Zones.city_id.requires = IS_IN_DB(db(Cities), 'cities.id', '%(label)s')
>
>
> i need to create a form to fill the Adverts with zones per selected city.
>
>
> Rgds
>
> Diego
>

-- 
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: Form string display mask

2018-09-17 Thread Massimo Di Pierro
https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html

On Friday, 14 September 2018 06:05:22 UTC-7, Yann Dulondel wrote:
>
> Hello,
> My user have to enter container number.
> The container number is a string of lenght 11 char
> The data for example is FCIU5808141 that must be display as FCIU 580 814/1
>
> In my c/s application i just have to specify a display mask  as ' @@@ 
> @@@/@'
> Does exists something like that.
> I use the format for date in web2y work fine and try to use format to 
> solve with no success.
>
> Yann
>

-- 
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: orderby and NULLS last

2018-09-17 Thread Massimo Di Pierro

db().select(orderby="sort_expression1 ASC NULLS LAST")

orderby can be a string in SQL.


# from gluon.dal import Expression was a cut and paste error

On Monday, 17 September 2018 21:40:53 UTC-7, Massimo Di Pierro wrote:
>
> from gluon.dal import Expression
>
> db().select(orderby="sort_expression1 ASC NULLS LAST")
>
> orderby can be a string in SQL.
>
>
>
> On Monday, 10 September 2018 01:10:08 UTC-7, Mike Constabel wrote:
>>
>> Hello, 
>>
>> is it possible to sort NULLS last with orderby desc? 
>>
>> orderby=~db.table.last_login 
>>
>> I want the empty last_login last in desc sorting. 
>>
>> On postgresql: 
>>
>> ORDER BY sort_expression1 [ASC | DESC] [NULLS { FIRST | LAST }] 
>>
>>
>> Thanks, 
>> Mike 
>>
>

-- 
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: orderby and NULLS last

2018-09-17 Thread Massimo Di Pierro
from gluon.dal import Expression

db().select(orderby="sort_expression1 ASC NULLS LAST")

orderby can be a string in SQL.



On Monday, 10 September 2018 01:10:08 UTC-7, Mike Constabel wrote:
>
> Hello, 
>
> is it possible to sort NULLS last with orderby desc? 
>
> orderby=~db.table.last_login 
>
> I want the empty last_login last in desc sorting. 
>
> On postgresql: 
>
> ORDER BY sort_expression1 [ASC | DESC] [NULLS { FIRST | LAST }] 
>
>
> Thanks, 
> Mike 
>

-- 
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: Prevent 1st row from deleting

2018-09-17 Thread Massimo Di Pierro
how about this?

db.define_table('thing', Field('name'), auth.signature)

user_to_delete = 5
first_thing = db(db.thing.created_by==user_to_delete).select(db.thing.id, 
limitby=(0,1)).first()
db(db.thing.created_by==user_to_delete)(db.thing.id!=first_thing.id).delete()

On Sunday, 9 September 2018 13:11:41 UTC-7, Maurice Waka wrote:
>
> I am trying to delete rows.
> I want to delete rows only posted by a specific user and not just do 
> db.post.delete()
> I also want to preserve the first row, something like if db.post.count() 
> >1:deletable = True else deletable = False but this is not working for me.
> How do I achieve these two?
> Regards 

-- 
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: Stats from Jetbrains

2018-09-17 Thread Massimo Di Pierro
Very interesting stats. 6%. Not bad at all.

On Tuesday, 4 September 2018 21:07:59 UTC-7, Carlos Cesar Caballero wrote:
>
> Hi, there are some interesting stats published by Jetbrains 
> https://www.jetbrains.com/research/devecosystem-2018/python/ 
>
>
> Greetings. 
>
>
>

-- 
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: import integer (E+12) from csv

2018-09-17 Thread Massimo Di Pierro
Unless you specify

Field(, requires=IS_INT_IN_RANGE(-1e100,1e100))

it defaults to IS_INT_IN_RANGE(-1e12, +1e12). Yes it is an odd choice.

On Monday, 3 September 2018 07:53:29 UTC-7, broneksmig...@gmail.com wrote:
>
> Hello, 
>
> I am using the database administration tool to import a small portion of 
> data to one of the tables in my db (standard sqlite). The code to create 
> the table:
>  db.define_table('dict_prod_match',
> Field('prod_tes_id','integer'), #this field is causing 
> troubles
> Field('prod_ros_id','integer')
> )
> Even though, the first field is 13 digits long so should be valid for 
> integer => (
> IS_INT_IN_RANGE(-1e100, 1e100)
> )
> , I have problems with uploading the data (and receive None instead of 
> value). When I tried to insert one record manually I received an error 
> notification to Enter an integer between -2.14748e+09 and 2.14748e+09. 
>
> Could you please help me with resolving the issue? Thank you very much in 
> advance!
> Best Regards, 
>

-- 
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: Smartgrid links with many-to-many join tables

2018-09-17 Thread Massimo Di Pierro
It is not that it does not work. it just treats a link table as a normal 
table, instead it should hide it and only use it to build the queries. it 
is not a hard change to make but we never got to make it because we always 
plant to reimplement the grid in a more modular manner

On Monday, 3 September 2018 06:53:01 UTC-7, miihe...@gmail.com wrote:
>
> Hi,
>
> thanks for taking the time to answer. I quickly tested this and it's 
> effectively the solution I referred to as circumventing the problem. I 
> could define controller functions (response mappings) manually and then 
> lambdaing the links to them, but it'd require a lot of code and I'd lose 
> the really helpful hierarchy tree present in the smartgrid. 
>
> In my project I've certain root objects that are referred to from multiple 
> other objects (both directly and via join tables) and for as long as the 
> relations are direct (ie. without join table but direct reference) the 
> smartgrid works flawlessly and allows the user to navigate the tree, easily 
> viewing what kind of elements are linked to the current object and adding 
> new ones at arbitrary levels of hierarchy without any extra code. I was 
> really impressed with this feature when I first tried it.
>
> I just wonder why the M-to-M breaks, as it does render otherwise perfectly 
> but for that missing link to joined (by join table) entity. Since this 
> probably isn't simple error from my part but more like an uncommon need 
> (doubt join tables are really managed explicitly in many cases), the 
> smartgrid does not support it out of the box. I'll try to fiddle with the 
> source code and see if I could make it work.
>

-- 
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: Help with CAS logout

2018-09-17 Thread Massimo Di Pierro
I think what you want should be an option of CAS (not implemented). You can 
implement it yourself with, for example:

import requests
auth.settings.logout_onlogout = lambda user: raise 
HTTP(auth.settings.cas_provider+'/logout')

On Sunday, 2 September 2018 21:46:31 UTC-7, fiubarc wrote:
>
> Hello! Thank you for your answer, now I understand. 
>
> I want, for example, that like google, when I log in to an application I do 
> not need to start it in the rest, 
> and when I close it, I can not enter the rest of the applications until I 
> start it again.
>
> Then in web2py I should share the session with any of the mechanisms 
> explained in the book, 
> sharing the folder in the network or in the database ... Am I right? 
>
> Would CAS in this case be helpful or would it not be necessary?
>
> Thanks!
>
>
>
> El domingo, 2 de septiembre de 2018, 14:59:22 (UTC-3), Massimo Di Pierro 
> escribió:
>>
>> I think this is a feature, not a bug, as each app has the its own 
>> session. But I see why you would want a different behavior.
>> Problem is, as implemented, provider has no info about consumer apps.
>>
>> On Wednesday, 1 August 2018 13:00:05 UTC-7, fiubarc wrote:
>>>
>>> Hello, I am wanting to implement CAS, but during the tests, when I close 
>>> session in the "provider" application it does not close the session in the 
>>> rest of the "consumers" applications. 
>>>
>>> I have several applications distributed on several servers and the CAS 
>>> application on a separate server. They all share the same user storage.
>>>
>>> The question is if I lack some configuration. I tried sharing the session 
>>> in the database, but I do not know what else to try.
>>>
>>> Any help would be appreciated!
>>>
>>>

-- 
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: Form submit takes too long

2018-09-17 Thread Massimo Di Pierro
I understand the confusion. In SQLAlchemy for example people use .first() 
for fetch one record. In web2py the feching is by the select. .first() just 
gives you the fist of the records that were retrieved.

On Sunday, 2 September 2018 18:52:35 UTC-7, Anthony wrote:
>
> - my first attempt will be to try to add indexes in the post and answers 
>> Table on the field author.
>> - secondly i will try to change this row
>>
>>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>>> message, orderby=~db.post.id, limitby=(0,1)).first()
>>
>> to this
>>>
>>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>>> message, orderby=~db.post.id).first()
>>
>>
>> limitby ist not needed in that case. it is just my opinion.
>>
>
> Why would you not use limitby? Without limitby, the database will return 
> every record in the table, and the the DAL will have to parse every record 
> and convert it to a Row object -- and then all of those Row objects will 
> simply be ignored, as only the first will be used in the code.
>
> Anthony
>

-- 
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 website list

2018-09-17 Thread Massimo Di Pierro
Thanks for letting us know. :-)

We have not done a good job at maintaining that list and we should clean it 
up. Anyway, you should be able to submit the site yourself. Let us know if 
it doe not work and we will fix it. http://web2py.com/poweredby

On Sunday, 2 September 2018 14:28:08 UTC-7, Gualter Portella wrote:
>
> Hi everyone, 
> I would like to thank this great community for supporting the amazing 
> Web2py framework! 
> About a year ago I was barely able to write a few lines of python code and 
> now I have finished my webapp dedicated to financial information from 
> Brazilian financial system! 
> If you think the app deserves to be included in the Web2py sites powered 
> list, please do so(bankmark.com.br). It will be an honor. 
> Anyway, I cannot thank you enough for your support and dedication! 
> Cheers, 
>
> Enviado do meu iPhone

-- 
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: MySQL, self-reference, and null values

2018-09-17 Thread fkn sec
Noticed when doing the migration, you have to both add the group and 
manually add the user in the database table. That solved my issue. 

On Friday, February 1, 2013 at 10:20:54 AM UTC-5, Loïc wrote:
>
> Dear All,
>
> I have a 'page' model with a sef-reference: 
> db.define_table('page',
> Field('parent', 'reference page', readable=False, writable=False),
> Field('title', unique=True, notnull=True)
> //more fields not important here
> )
>
> When I insert a new page via appadmin without specifying a 'parent', 
> everything is OK with sqlite
>
> Since I moved my database to mysql, I have an error : 
>  (1452, 'Cannot add or update a 
> child row: a foreign key constraint fails (`dommartin25`.`page`, CONSTRAINT 
> `page_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `page` (`id`) ON DELETE 
> CASCADE)')
> How can I allow null values for the 'parent' field?
>
> Thank you
>

-- 
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 auth through AWS cognito

2018-09-17 Thread kryton4567


I am changing the login authentication to be handled by AWS Cognito and 
require some clarification around the approach as cannot get it to work 
correctly

   1. I have created a class cog_login that has been assigned to the

auth.settings.login_methods = [cog_login]

   1. 
   
   One of the functions that is in the class is called authenticate() that 
   takes username and password arguments that the user enters from the 
   standard web2py forms user/login
   2. 
   
   In the def user() controller in default I have the following:
   
cog_login().authenticate(request.vars.email, request.vars.password)

This queries AWS and returns True if passes, False otherwise.

   1. 
   
   I am not clear on what to do with the True, False response within the 
   def user() as it doesn't seem to populate auth.user which always remains as 
   None.
   2. 
   
   I have tried to force the population of auth.user getting the contents 
   of auth_user, i.e. auth.user = row[0]. This does populate auth.user 
   performing tests auth.is_logged_in() results in a True response.
   
However when continuing through the def user() the standard onlogin 
redirect doesn't forward to the main page indicating web2py isnt recording 
this as authentication accepted.

   1. I have also tried a redirect if "auth.is_logged_in()" but the 
   decorators @auth.requires_login on the main page don't detect the login and 
   redirect back to the login page.

--

Is this approach correct, I seem to be missing a step that knits the 
successful AWS login to Web2py

-- 
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] Autocomplete widget match middle of word

2018-09-17 Thread Al Ex
SQLFORM.widgets.autocomplete has the parameter: at_beginning that you can
set to False


https://web2py.readthedocs.io/en/latest/_modules/gluon/sqlhtml.html#AutocompleteWidget

widget = SQLFORM.widgets.autocomplete(request, ..., at_beginning=False,
)




On September 15, 2018 at 10:15:25 PM, Anders Meyer (meyer.and...@gmail.com)
wrote:

Hello- I'm using the autocomplete widget to make sure that the user chooses
among names in a database (containing about 300 entries). Right now, the
autocomplete only matches from the beginning of the word, but I need it to
be able to match from any position in the word, similar to what jquery
allows. Any suggestions for how to do this? Many thanks!
--
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] Using DAL / existing Databases

2018-09-17 Thread Ben Duncan
Ok, sorry if this may seem like a long post to some.

I have created a framework of sorts to generate tables for an accounting
system.

They tables themselves are generate from various Python programs that read
layouts from old COBOL programs/ AppGen 4gl / Informix schemas , Oracle
schemas ,Tryton and Oodo and  taking the best ideas from all. The
procedures create a template file that I then use to generate the complete
structure for the accounting system database.

I need to get these layouts into web2py to start building my applications.
It is for a Postgres based database only (on  my end).

The questions are (and based on the template file at the end):

A: How easy to adapt my generator to auto create the necessary DAL entries
into the database section of web2py

B: I saw that I can use Postgres to store my DAL information rather that
flat files and Iv'e lost my links to that - can this be automated as well?

Thanks In advance - Ben Duncan

Sample - Accounts Receivable Open Item File:

# Generator Parameters:
# : = End Type of field , '|' = Field seperators
#
# FILE = Table Name to generate
# ENDFILE - End of Table Defination
# DESC - Descriptive Information for Documentor

# Lines that start with FORKEY are foreign key layouts
# They are divided by '|':
# Column 1 is name of the key ,Names to be created by FILE__fkey
# column 2 is referenced (parent) table
# Column 3 is names of fields in the layout that make up the fk layout
# They are divided by ',':
# Optional Column 4 is the Referential Action to be performed:
# On DELETE, ON UPDATE, etc...
# Program will generate key in the format of
# __fkey

# Lines that start with SECKEY are secondary keys.
# Column 1 is the key name
# Column 2 is the list of keys to form the secondary keyes
# They are divided by ',':
# Program will generate key in the format of
# __idx

# Lines that start with UNIKEY are unique secondary keys.
# Column 1 is the key name
# Column 2 is the list of keys to form the secondary keyes
# They are divided by ',':
# Program will generate key in the format of
# __idx
#
# Program will generate key in the format of
# __fkey
#

# Lines that start with FIELDS: are the field definitions.
# First Field After the ':' is a Type (single Value or multi value -
#   not used at this time)
# Second is the 'K' value that signifies this is part of the
#  primary key, if not K, it is ignored.
# Third is 'N"' for producing 'NOT NULL'
# Forth is the field name
# Fifth is the Descriptive narrative for the field used by
#   documentor
# Sixth is the TYPE
# Seventh is the length (ignored for default types)
# Eight is for any additional constraints - "DEFAULT 0" ...etc
#

FILE:AR_OPEN
DESC:Ar Open Items
DESC: This is the OPEN items file.
DESC: For MEC use the REFERENCE to refer to CASE details.
DESC: DOC_TYPE - I = Invoice, P = Payment, N = Interest, F = Add on Fee
DESC:C = Credit mem0, D = Debit Memo
FORKEY: COMPANY|COMPANY|COMPANY_NUMBER|ON DELETE CASCADE
FORKEY: CLIENT|CLIENT|COMPANY_NUMBER,CLIENT_NUMBER|ON DELETE CASCADE
SECKEY: AR_OPEN_DOC|COMPANY_NUMBER,DOC_NO
FIELDS:S|K|N|COMPANY_NUMBER|Company ID|N6,06|99|
FIELDS:S|K|N|CLIENT_NUMBER|Customer Code|N12,012|12|
FIELDS:S|K|N|DOC_NO|Document Number|N10,012|999|
FIELDS:S|0|N|POSTED_TIMESTAMP|Posted Time Stamp|T|12|
FIELDS:S|0|N|DOC_TYPE|Doc Type - I = Invoice, P = Payment, I = Interest, F
= Add on Fee|A|1|
FIELDS:S|0|N|DOC_DATE|Original Doc Date|D|8|
FIELDS:S|0|0|ORIG_DOC|Original Document|N10,012|9|
FIELDS:S|0|0|HOLD_TO_DATE|Date to start AGEING |D|8|
FIELDS:S|0|0|ORIGINAL_AMOUNT|ORIGINAL AMOUNT|MONEY|9|
FIELDS:S|0|0|BAL_DUE|Document Balance|MONEY|9|DEFAULT 0
FIELDS:S|0|0|PAID_AMOUNT|Paid on Item|MONEY|9|DEFAULT 0
FIELDS:S|0|0|DISC_AMT|Applied Discount|MONEY|9|DEFAULT 0
FIELDS:S|0|0|REFERENCE|Reference/Case ID|V|255|
FIELDS:S|0|0|APPLIED_DATE|Date Applied|D|8|
FIELDS:S|5|0|APPLIED_DOC|Applied Doc_NUM|N10,012|999|
FIELDS:S|0|0|APPLIED_REF|Applied Reference|V|25|
ENDFILE:

-- 
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: default search string in SQL.grid

2018-09-17 Thread 'Matthew J Watts' via web2py-users
thanks that worked a treat! So was that done using jquery? I still have to
learn about it

On Thu, Sep 13, 2018 at 5:39 PM Anthony  wrote:

> On Thursday, September 13, 2018 at 8:36:11 AM UTC-4, Marcelo Huerta wrote:
>>
>> El jueves, 13 de septiembre de 2018, 8:10:48 (UTC-3), Matthew J Watts
>> escribió:
>>>
>>> Hello all
>>>
>>> Is there a way  to pre populate the  'search field' of the SQLFORM.grid?
>>>
>>>
>>>
>> In your URL to the function containing the grid, you can pass the search
>> string in the vars dictionary. Just assign it to the "keywords" key.
>>
>
> That's the way to go if you want the grid to show the actual results of
> the search. If you want the standard set of records but simply want to
> pre-populate the search box, you can do:
>
>  grid = SQLFORM.grid(db.mytable)
>  search_input = grid.element('#w2p_keywords')
>  if search_input:
>  search_input['_value'] = 'My keywords'
>
> Anthony
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/yohSjabLPCE/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Setting filename to a streamed file

2018-09-17 Thread Simona Chovancová
Thanks, worked 

On Thursday, September 13, 2018 at 5:18:25 PM UTC+2, 
tim.n...@conted.ox.ac.uk wrote:
>
> Are you setting the PDF's title before streaming it?
>
> pdf.set_title('Whatever you want to appear in the tab')
> pdf_stream = pdf.output(dest='S')
>
>
>
> On Thursday, 6 September 2018 13:16:32 UTC+1, Simona Chovancová wrote:
>>
>> Hello.
>> I have a backend function that is supposed to stream a pdf file, but not 
>> instantly download it. It's being called like this 
>> .../function_to_create_pdf/323, where the number is some ID. I create a 
>> FPDF stream and make function return this
>> response.headers['Content-Type'] = None
>> return response.stream(pdf_stream, 4096, filename="iwanthisname.pdf")
>>
>> Soo the problem is, this works well if I set attachment=True, but since I 
>> only want to display this pdf file, the filename is not applied in any way. 
>> I get the right document and all that, but the browser tab title is 
>> basically just the argument (ID) I passed to the function and if I press 
>> the download button it is saved as 323.pdf. I want to edit its name, how 
>> can I do this? I tried changing tab name with reponse.title, but it didn't 
>> work. Thank you.
>>
>

-- 
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: Python loop brings an error

2018-09-17 Thread Lovedie JC
When I restart the app rhea,error disappears briefly then recurs.

On Sep 12, 2018 1:30 AM, "Leonel Câmara"  wrote:

> I haven't tried it, but are you using global variables inside your
> controller file? You could easily be always using the same results list
> which you are always appending to.
>
> --
> 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: Create a drop-down menu from a database

2018-09-17 Thread Diego Tostes
Massimo,

may i use multiple fields on SQLFORM.factory?

may be a solution to create a form with the functionality of set a state 
and automatically fill a dropdown with all cities from selected state, set 
a city and automatically fill a dropdown with all zones from that selected 
cities... 

#my db.py

Adverts_Type = db.define_table('adverts_type', 
   Field('label', 'string'),
   Field('description', 'text'),
 )

States = db.define_table('states',
   Field('label', 'string'),
 )

Cities = db.define_table('cities',
   Field('state_id', db.states),
   Field('label', 'string'),
 )

Zones = db.define_table('zones', 
   Field('city_id', db.cities),
   Field('label', 'string'),
 )


Adverts = db.define_table('adverts',
   Field('owner_id', 'integer'),
   Field('type_id', adverts_type),
   Field('description', 'text'),
   Field('image', 'upload'),
   Field('city_id', 'integer'),
   Field('zone_id', 'integer'),
 )



Adverts.type_id.requires = IS_IN_DB(db(Adverts_Type), 'adverts_type.id', 
'%(label)s')
Cities.states_id.requires = IS_IN_DB(db(States), 'states.id', '%(label)s')
Zones.city_id.requires = IS_IN_DB(db(Cities), 'cities.id', '%(label)s')


Em quarta-feira, 1 de fevereiro de 2012 18:35:38 UTC-2, Massimo Di Pierro 
escreveu:
>
> Something like this? 
>
> db.define_table('cities', 
> Field('name'), 
> Field('state'), 
> format = '%(name)s' 
> ) 
>
>
> form = SQLFORM.factory(Field('choose_city','reference cities')) 
>
> On Feb 1, 2:25 pm, shartha  wrote: 
> > So the problem is two folds. I have defined a simple table as in: 
> > 
> > db = DAL("sqlite://storage.sqlite") 
> > 
> > db.define_table('cities', 
> > Field('name'), 
> > Field('state'), 
> > ) 
> > 
> > Now I'd like to have a drop-down list in my view that reads from the 
> > name filed of the database cities. How can I achieve this? Any help 
> > would be highly appreciated. 
> > 
> > Thanks! 
> > S.

-- 
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: Autocomplete widget match middle of word

2018-09-17 Thread 'Annet' via web2py-users
Hi Anders,

In the query use .contains()

Something lijke:

rows = db(db.table.field.contains(request.get_vars.term, 
case_sensitive=False)).select().as_list()


Best,

Annet

-- 
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: Err while trying to submit a new web2py site

2018-09-17 Thread Rahul
Hi Everyone,
 Any updates on this yet ? 

Rahul

On Tuesday, September 4, 2018 at 10:19:02 AM UTC+5:30, Rahul wrote:
>
> Hi All,
>  I am not able to submit a new site [
> http://web2py.com/poweredby/default/submit]. While doing that a ticket is 
> raised. Please see the screenshot attached.
>
> Rahul
>

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