Re: [web2py] py4web has now a grid ...

2019-09-13 Thread Massimo Di Pierro
Nothing prevents you from including css into the .html of linking a css 
file from html.
Not sure that is a good idea because pages look nicer when there is one 
single css style.


On Friday, 13 September 2019 06:16:45 UTC-7, Carlos Costa wrote:
>
> I like the idea of loading components dynamically.
> My only point about SFC is about being a standard. 
>
> And what about css? Could it be a TFC Three-File-Components?
>
>
> Em sex, 13 de set de 2019 às 01:11, Massimo Di Pierro <
> massimo.dipie...@gmail.com> escreveu:
>
>> To clarify.
>>
>> I do not like SFC because I do not think js and html belong to the same 
>> file. py4web has a utils.js which implements a TFC Two-File-Components (I 
>> claim copyright). This is undocumented and you will not see it in other vue 
>> apps.
>>
>> Basically each component has on js and one html file. In the case of the 
>> grid one mtable.js and one mtable.html. You can customize the html as you 
>> see fit without need to touch the JS. The JS is not done and I will be 
>> adding some functionality. In particular I need to handle events to allow 
>> to save the grid state in the url.
>>
>>
>>
>>
>>
>> On Thursday, 12 September 2019 06:52:23 UTC-7, Carlos Costa wrote:
>>>
>>> It's done.
>>> But I have a question: where will we put component styling?
>>> I add an table.css file and linked in layout.html but I think it belongs 
>>> to the component.
>>> I wish we would use Vue SFC format. 
>>> Now  is possible to use SFC components without using bundlers.
>>>
>>>
>>> Em qui, 12 de set de 2019 às 09:52, Carlos Costa <
>>> yamandu.co...@gmail.com> escreveu:
>>>
 I liked it.
 Much more faster and responsive.

 I didn't get how use search properly.

 I have on suggestion for letting grid more mobile friendly.
 Take a look at this snippet https://codepen.io/andornagy/pen/EVXpbR
 It is pure CSS.
 It transform columns into rows in a card style table.
 I have used it, it is very cool, and I think at least the grid should 
 be mobile friendly.
 The only problem is that you must have a data-column attribute.
 I have used to manipulate the w2p grid in order to inject this 
 attribute but this is very slow.
 The ideal is it to be generated with this attribute already.
 Maybe I can do a PR with this feature.


 Em qui, 12 de set de 2019 às 03:31, Massimo Di Pierro <
 massimo.dipie...@gmail.com> escreveu:

> ... it is incomplete. It is experimental. The API is subject to 
> change. But I could use some community feedback:
>
> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>
>
> # exposes services necessary to access the db via ajax
> publisher = Publisher(db, policy=ALLOW_ALL_POLICY) 
>
>
> # expose as /examples/grid 
> @action('grid') 
> @action.uses('grid.html') 
> def example_grid(): 
>  return dict(grid=publisher.grid(db.person)) 
>
> embed in template with [[=grid]] in templates/grid.html as in web2py. 
> The difference from web2py is that the grid communicate with the 
> server via ajax and the style is in static/components/mtable.html
> Still does not access authentication based access control but will add 
> it very soon.
>
> You can try it.
>
> https://github.com/web2py/py4web/blob/master/apps/examples/__init__.py#L41
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/cc53051f-104c-4b20-97a6-c32f8220d052%40googlegroups.com
>  
> 
> .
>


 -- 
 At.

 Carlos J. Costa
 --
 Cientista da Computação - Esp. Gestão em Telecom

>>>
>>>
>>> -- 
>>> At.
>>>
>>> Carlos J. Costa
>>> --
>>> Cientista da Computação - Esp. Gestão em Telecom
>>>
>> -- 
>> 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.
>>

[web2py] Re: 1215 Cannot add foreign key constraint

2019-09-13 Thread Steve
Hi Dave,

Finally i got to the root of the problem :-)
Turns out to be a builders error ... yes, my own error.


In the very first table there is a reference to a logged in user which does 
not exist when trying to create the tables ( same for loading the data).
Quick work around is swapping two tables and after that prefill the first 
table with a couple of records.
After that i could upload my backup data withoout a problem.

Thanks for the help.

Rgards,

Steve
Op donderdag 12 september 2019 10:49:15 UTC+2 schreef Dave S:
>
>
>
> On Wednesday, September 11, 2019 at 1:55:04 PM UTC-7, Steve wrote:
>>
>> Hi Dave,
>>
>> After performing a Fake_migration_all=True the Db files where created in 
>> de app/databases folder.
>> So, in de admin i can see all of the tables.
>>
>> But, unfortunatly the tables where NOT created in the MySQL database.
>> I can't find ou why not or how to fix this.
>>
>>
> fake_migration ONLY creates *.table files, and is primarily for already 
> existing tables (e.g., legacy) DBs.  To create an actual DB table requires 
> migration rather than fake_migration.  And as Niphlod has often pointed 
> out, migrate=True only needs to be set for one access, and then you turn it 
> back off.
>
> /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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/da151e9d-573d-4274-a07b-b1341b9d8ead%40googlegroups.com.


[web2py] Re: 1215 Cannot add foreign key constraint

2019-09-13 Thread Steve
Hi Dave,

Ok, that fake_migration only creates *.tables file i did not know
Migrate True only one time .. that i knew but for some reason only 1 table 
is created from the 25+ so something is wrong.

Don't know what yet



Op donderdag 12 september 2019 10:49:15 UTC+2 schreef Dave S:
>
>
>
> On Wednesday, September 11, 2019 at 1:55:04 PM UTC-7, Steve wrote:
>>
>> Hi Dave,
>>
>> After performing a Fake_migration_all=True the Db files where created in 
>> de app/databases folder.
>> So, in de admin i can see all of the tables.
>>
>> But, unfortunatly the tables where NOT created in the MySQL database.
>> I can't find ou why not or how to fix this.
>>
>>
> fake_migration ONLY creates *.table files, and is primarily for already 
> existing tables (e.g., legacy) DBs.  To create an actual DB table requires 
> migration rather than fake_migration.  And as Niphlod has often pointed 
> out, migrate=True only needs to be set for one access, and then you turn it 
> back off.
>
> /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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d70f19b2-1f97-49ca-9c8b-5b1da7b02db8%40googlegroups.com.


Re: [web2py] py4web has now a grid ...

2019-09-13 Thread Carlos Costa
I like the idea of loading components dynamically.
My only point about SFC is about being a standard.

And what about css? Could it be a TFC Three-File-Components?


Em sex, 13 de set de 2019 às 01:11, Massimo Di Pierro <
massimo.dipie...@gmail.com> escreveu:

> To clarify.
>
> I do not like SFC because I do not think js and html belong to the same
> file. py4web has a utils.js which implements a TFC Two-File-Components (I
> claim copyright). This is undocumented and you will not see it in other vue
> apps.
>
> Basically each component has on js and one html file. In the case of the
> grid one mtable.js and one mtable.html. You can customize the html as you
> see fit without need to touch the JS. The JS is not done and I will be
> adding some functionality. In particular I need to handle events to allow
> to save the grid state in the url.
>
>
>
>
>
> On Thursday, 12 September 2019 06:52:23 UTC-7, Carlos Costa wrote:
>>
>> It's done.
>> But I have a question: where will we put component styling?
>> I add an table.css file and linked in layout.html but I think it belongs
>> to the component.
>> I wish we would use Vue SFC format.
>> Now  is possible to use SFC components without using bundlers.
>>
>>
>> Em qui, 12 de set de 2019 às 09:52, Carlos Costa 
>> escreveu:
>>
>>> I liked it.
>>> Much more faster and responsive.
>>>
>>> I didn't get how use search properly.
>>>
>>> I have on suggestion for letting grid more mobile friendly.
>>> Take a look at this snippet https://codepen.io/andornagy/pen/EVXpbR
>>> It is pure CSS.
>>> It transform columns into rows in a card style table.
>>> I have used it, it is very cool, and I think at least the grid should be
>>> mobile friendly.
>>> The only problem is that you must have a data-column attribute.
>>> I have used to manipulate the w2p grid in order to inject this attribute
>>> but this is very slow.
>>> The ideal is it to be generated with this attribute already.
>>> Maybe I can do a PR with this feature.
>>>
>>>
>>> Em qui, 12 de set de 2019 às 03:31, Massimo Di Pierro <
>>> massimo.dipie...@gmail.com> escreveu:
>>>
 ... it is incomplete. It is experimental. The API is subject to change.
 But I could use some community feedback:

 from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY


 # exposes services necessary to access the db via ajax
 publisher = Publisher(db, policy=ALLOW_ALL_POLICY)


 # expose as /examples/grid
 @action('grid')
 @action.uses('grid.html')
 def example_grid():
  return dict(grid=publisher.grid(db.person))

 embed in template with [[=grid]] in templates/grid.html as in web2py.
 The difference from web2py is that the grid communicate with the server
 via ajax and the style is in static/components/mtable.html
 Still does not access authentication based access control but will add
 it very soon.

 You can try it.

 https://github.com/web2py/py4web/blob/master/apps/examples/__init__.py#L41

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/web2py/cc53051f-104c-4b20-97a6-c32f8220d052%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>> At.
>>>
>>> Carlos J. Costa
>>> --
>>> Cientista da Computação - Esp. Gestão em Telecom
>>>
>>
>>
>> --
>> At.
>>
>> Carlos J. Costa
>> --
>> Cientista da Computação - Esp. Gestão em Telecom
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/31e01207-4fbe-4d8e-9cd8-8bcfc53ac06f%40googlegroups.com
> 
> .
>


-- 
At.

Carlos J. Costa
--
Cientista da Computação - Esp. Gestão em Telecom

-- 
Resources:
- http://web2py

Re: [web2py] Why is my if/else statement not working

2019-09-13 Thread Jirawat Kusolpreedee
every python code must be enclosed in {{}} also you need a {{pass}} at the
end of if-else statement

On Fri, Sep 13, 2019 at 2:31 PM mostwanted  wrote:

> This conditional statement should be simple & execute without any issues,
> I have created a point of Sale system, in a view it shows all the items &
> their available quantities, what i want is that when a product's quantity
> goes below 10 the quantity figure should turn red & a please refill message
> should be displayed but i am not getting this, the if condition is ignored
> altogether, only the else statement is executed!
>
> VIEW CODE
> 
> .refill
> {
> display: none;
> color: red;
> font-weight: bold;
> padding: 2px;
> }
> 
> {{for idx, p in enumerate(products, start=1):}}
>
>   
>   
> $(document).ready(function()
>{
> if({{=p.Quantity}} <10)
> {
> $('span.quantity').css({'color':'red'});
> $('.refill').show();
> }
> else
> {
> $('span.quantity').css({'color':'green'});
> $('.refill').hide();
> }
> });
> 
>   {{=idx}}
> 
>   {{=p.Quantity}} Please Refill
> ...
> ...
> ...
> ...
> ...
> ...
>
> Please assist
>
> Regards;
>
> Mostwanted
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/c26be28b-585d-452d-a255-6ba9be30f67b%40googlegroups.com
> 
> .
>


-- 
โทร 086-187-5643

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


[web2py] Why is my if/else statement not working

2019-09-13 Thread mostwanted
This conditional statement should be simple & execute without any issues, I 
have created a point of Sale system, in a view it shows all the items & 
their available quantities, what i want is that when a product's quantity 
goes below 10 the quantity figure should turn red & a please refill message 
should be displayed but i am not getting this, the if condition is ignored 
altogether, only the else statement is executed!

VIEW CODE

.refill
{
display: none;
color: red;
font-weight: bold;
padding: 2px;
}

{{for idx, p in enumerate(products, start=1):}}

  
  
$(document).ready(function()
   {
if({{=p.Quantity}} <10)
{
$('span.quantity').css({'color':'red'});
$('.refill').show();
}
else
{
$('span.quantity').css({'color':'green'});
$('.refill').hide();
}
});

  {{=idx}}

  {{=p.Quantity}} Please Refill
...
...
...
...
...
...

Please assist

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c26be28b-585d-452d-a255-6ba9be30f67b%40googlegroups.com.


Re: [web2py] Re: Whats the best way to create an Android or iOS app for web2py project

2019-09-13 Thread Rahul Dhakate
Thanks! Dave and Pbop for getting back with the answers. Sorry about
posting less details

*@dave* - No, I do not intend to run web2py on mobile device. Web2py would
serve my application on the web as it usually does.

The idea is to write another simple iOS or Android application in some tool
like say what *Pbop* mentioned.( Or Python if we can and if supported!)

 I want to connect to my web2py web application  from the mobile or PDA app.
So yes - I wanna do the following -

*Do you want to access a [remote] web2py server from a native app on the
portable device?*
* YES sort of where I will only access postgres database of the application
by passing web2py app. I was researching if python could come in handy for
this..*

My application already works on mobile device in responsive fashion however
I would want a stripped down version with a few mobile specific features
added for a great user experience.

*So for —- *
2) How can we access a postgres database residing on linux server for a
web2py application from such an application?
*To Add *- Here The application and database reside on the same linux box.


Let me know on these and a couple questions I posted below.


Regards,

*Rahul*

On Wed, 11 Sep 2019 at 2:24 PM, Dave S  wrote:

>
> On Friday, September 6, 2019 at 4:28:30 AM UTC-7, Rahul wrote:
>>
>> Hey Everyone,
>>  I have some interesting questions (It might have been asked before)
>> I want to know -
>>
>> 1) Whats the best way to create an Android or iOS app for web2py project?
>>
>
> What's the goal?  Do you want web2py running as a server on the portable
> device?  Do you want to display on the portable device pages served by a
> [remote] webserver?  Do you want to access a [remote] web2py server from a
> native app on the portable device?
>
> Note that a remote web2py server using the view tools that come with it
> produces pages that are mobile-friendly (er, "responsive") in the sense of
> adapting to the screen size in various ways.
>
>
>> 2) How can we access a postgres database residing on linux server for a
>> web2py application from such an application?
>>
>
> Can't answer this one without knowing more about what #1 means.  A quick
> note that a remote web2py server could be running on the linux server with
> the database, or on a separate server, just as for any "normal"  web2py
> installation.
>
>
>> 3) Can we use python to write such apps?
>>
>
> See above.  I think I've seen mention of native python on mobile devices,
> but perhaps not included in any of the development tools for the device.
>
>
>> 4) Has anyone written any apps that do the above successfully?
>>
>>
>> Rahul
>>
>
>
> Good luck!
>
> /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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/33bOyQHDtfM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/76f02897-1f23-4503-919e-3df81cfee1eb%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CA%2B6uMjejg-MR-ORJi2qURH-26WH-DeVhqmQn6jsaq0Q%2B8mAbTQ%40mail.gmail.com.