[web2py] Re: How to handle dynamic forms?

2016-06-10 Thread desta
Thank Anthony. In the same context, how can I handle file uploads? On Friday, June 10, 2016 at 6:59:40 PM UTC+3, Anthony wrote: > > On Friday, June 10, 2016 at 11:28:15 AM UTC-4, desta wrote: >> >> Thank you both. So let's assume that I designed the dynamic form using

[web2py] Re: How to handle dynamic forms?

2016-06-10 Thread desta
> > On Thursday, June 9, 2016 at 5:26:32 PM UTC-4, desta wrote: >> >> Something like this: >> >> >> * ## Personal Details ## >> * Name:_ >> * Surname: _

[web2py] Re: How to handle dynamic forms?

2016-06-09 Thread desta
UTC+3, Dave S wrote: > > > > On Thursday, June 9, 2016 at 1:42:29 PM UTC-7, desta wrote: >> >> The book part that I mentioned is a part of much larger form, that has >> more dynamic elements. So I was thinking it was a good idea to store the >> whole for

[web2py] Re: How to handle dynamic forms?

2016-06-09 Thread desta
for each dynamic part of the form (similar to the books example). On Thursday, June 9, 2016 at 11:35:28 PM UTC+3, Dave S wrote: > > > > On Thursday, June 9, 2016 at 1:19:35 PM UTC-7, desta wrote: >> >> Well, I am really not sure how to implement this on database-side either,

[web2py] Re: How to handle dynamic forms?

2016-06-09 Thread desta
, 2016 at 10:23:58 PM UTC+3, Dave S wrote: > > > > On Thursday, June 9, 2016 at 11:47:43 AM UTC-7, desta wrote: >> >> Hello everyone, >> >> My current task is to create a form where fields can be added/removed. Is >> it possible to handle such forms with web

[web2py] How to handle dynamic forms?

2016-06-09 Thread desta
Hello everyone, My current task is to create a form where fields can be added/removed. Is it possible to handle such forms with web2py? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p

[web2py] Re: Edit form style

2016-01-20 Thread desta
I made the necessary changes to the "formstyle_bootstrap3_inline_factory" function in sqlhtml.py but they are not applied to the form when it is presented to in the browser. What am I missing here? Thank you. On Monday, January 18, 2016 at 10:36:51 AM UTC+2, desta wrote: > > De

[web2py] Re: Edit form style

2016-01-18 Thread desta
; in 2.12.03). > > Denes > > On Friday, January 15, 2016 at 4:41:33 AM UTC-5, desta wrote: >> >> I would like to make a change a the Login form. >> Currently I see that the login button has a slight offset which I like to >> remove >> >> >> >&g

[web2py] Edit form style

2016-01-15 Thread desta
I would like to make a change a the Login form. Currently I see that the login button has a slight offset which I like to remove I tried to search for *col-sm-offset-3 *to find where the form is generated but I could only find .css files where the style is defined. I searched in the gluon

[web2py] Re: Hide form field

2016-01-14 Thread desta
y( > Field('year', label='Year'), > Field('month', label='Month'), > hidden=dict(fieldname='field value')) > > > On Wednesday, 13 January 2016 11:21:11 UTC-6, desta wrote: >> >> Thank you Anthony for the help

[web2py] Re: Hide form field

2016-01-13 Thread desta
nth', readable=False, writable=True ))¬ On Wednesday, January 13, 2016 at 6:55:05 PM UTC+2, Anthony wrote: > > SQLFORM.factory(..., hidden=dict(fieldname='field value')) > > Anthony > > On Wednesday, January 13, 2016 at 11:35:57 AM UTC-5, desta wrote: >> >>

[web2py] Hide form field

2016-01-13 Thread desta
I am generating a form using SQLFORM.factory() and I would like to create a hidden field. I tried doing this by setting readable and writable to False, but the field dissapears from HTML. Is there a way to make it hidden but still accessible in HTML as I want to set its value with Javascript.

[web2py] Re: web2py as an API provider

2015-12-16 Thread desta
east, no unknown risk at any rate. > > On Wednesday, 16 December 2015 15:02:38 UTC, desta wrote: >> >> I am thinking of using web2py to build a REST API project. I believe that >> features like authentication and authorization will save me a lot of >> development time a

[web2py] web2py as an API provider

2015-12-16 Thread desta
I am thinking of using web2py to build a REST API project. I believe that features like authentication and authorization will save me a lot of development time and I will be able to focus on building the API. I already know that web2py is a great and reliable platform but I would like to hear y

[web2py] Re: How does 'default/user' works?

2015-09-09 Thread desta
Thank you. I am trying to follow the procedure. So when the login form is submitted, I guess line 1609 is called (?) https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1609. Following the getattr, I can't seem to find where it validates and redirects. Could you please enlighten me?

[web2py] How does 'default/user' works?

2015-09-09 Thread desta
Hello everyone. I want to understand how the login/register etc work. How does the 'default' controller exposes the 'user' functions? When the client requests 'default/user/login' what does the '/login' part do? In the 'default.py' file I see that the controller always returns a form 'return

Re: [web2py] Action when file streaming finishes

2015-09-04 Thread desta
os.tmpfile() you don't need to care > about deleting it, the system will take care of everything for you. > > -- > Yoel > > 2015-09-04 8:32 GMT-04:00, desta >: > > Hello, > > > > When the client clicks on a specific link, a temporary file is create

[web2py] Action when file streaming finishes

2015-09-04 Thread desta
Hello, When the client clicks on a specific link, a temporary file is created by a controller which is then downloaded (using the `response.stream`). I want to delete the file after the download finishes. Could you please share any suggestions? Thank you. -- Resources: - http://web2py.com -

Re: [web2py] Can the web2py validators be used outside of forms?

2014-12-10 Thread desta
;ba', ) # no pass > >>> IS_MATCH('a',strict=False)('ab') > ('a', None) # pass! > > > the second element of the output is expected to be an error message and if > it's None the test is a passed! > > Cheers > > Ma

[web2py] Can the web2py validators be used outside of forms?

2014-12-10 Thread desta
Hi, web2py features some really useful validators. Is it possible to use them outside of forms? For example, lets assume a string that contains comma separated emails as inputted from the user. After splitting the string to extract individual emails, can I use the IS_EMAIL validator to validate

[web2py] Re: Check is user is the owner of row (help with db query)

2014-09-10 Thread desta
Thanks Anthony, indeed I will have to evaluate the tradeoff of speed for complexity. I don't think that our site will have the amount of traffic that this would be a problem but its always good to know good practices! A friend suggested to use db((db.task.id == 5) & (db.task.ref_to_job == db.job

Re: [web2py] Re: Check is user is the owner of row (help with db query)

2014-09-08 Thread desta
Thank you guys for your valuable answers. On Monday, September 8, 2014 2:51:56 PM UTC+3, Marin Pranjić wrote: > > Make sure to read Authorization chapter in book: > > http://web2py.com/books/default/chapter/29/09/access-control#Authorization > > -- Resources: - http://web2py.com - http://web2py.

[web2py] Re: Check is user is the owner of row (help with db query)

2014-09-08 Thread desta
Thank you, so you mean is bad practice the way I implemented the tables? When I designed it like that, I thought it would be convenient in altering the relations between the records. On Monday, September 8, 2014 11:47:57 AM UTC+3, Leonel Câmara wrote: > > Frankly, I would just store the user as

[web2py] Check is user is the owner of row (help with db query)

2014-09-08 Thread desta
We have the default USERS table, a PROJECTS table that references back to USERS, a JOBS table that references back to PROJECTS and a TASKS table that references back to JOBS. Essentially USERS <- PROJECTS <- JOBS <- TASKS Now the client is logged in, requests to delete tasks with ID=5. In the

[web2py] Re: Security advice for updating records

2014-08-10 Thread desta
h.has_membership(group_name): > # whatever you decide to do with failed attempt > pass > # Your great code here > pass > > > > > On Friday, August 8, 2014 6:03:34 PM UTC-4, desta wrote: >> >> Let's assume a table: >> db.define_table

[web2py] Security advice for updating records

2014-08-08 Thread desta
Let's assume a table: db.define_table('SecretData', Field('data','string'), Field('file_owner', 'reference auth_user', default=auth. user_id) The table is already populated. On the *View* side, the user is able to send an ajax request which contains the *id*, and s

[web2py] Re: Hide a form field in view

2014-08-04 Thread desta
> form.vars.dynamic_field = [value calculated from existing form.vars] > > form = SQLFORM(db.mytable).process(onvalidation=add_dynamic_value) > > Anthony > > On Sunday, August 3, 2014 1:28:46 AM UTC+2, desta wrote: >> >> Is it possible, when creating a form wit

[web2py] Re: Controller wont return submitted row id

2014-08-04 Thread desta
It seems that the function returns the data correctly as you had stated from the beginning. For some reason firefox web tools don't show it. I used 'console.log' and I can see that the data is there. Sorry for the confusion. Thank you. On Sunday, August 3, 2014 1:21:33 AM UTC

[web2py] Re: Hide a form field in view

2014-08-03 Thread desta
I don't think I can use it because 'show_if' still happens in the controller. On Sunday, August 3, 2014 4:03:59 AM UTC+3, 黄祥 wrote: > > perhaps you can use, show_if. > > ref: > > http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields > > best regards, > stifan > --

[web2py] Hide a form field in view

2014-08-02 Thread desta
Is it possible, when creating a form with SQLFORM to set a field as hidden? In my application I have a form which one of its fields, has to be completed automatically i.e. not by the user. The problem is that the data that goes into that field is dynamic (depends on the actions of the user) and

[web2py] Re: Controller wont return submitted row id

2014-08-02 Thread desta
abase are you using? What is > the model? Is it possible your table does not have an auto increment id > field? > > On Saturday, 2 August 2014 03:50:24 UTC-5, desta wrote: >> >> Hi Massimo and thank you for the reply. A couple of questions >> 1) What are the asso

[web2py] Re: Controller wont return submitted row id

2014-08-02 Thread desta
equest.env.request_method == 'POST': > r = db.sample.validate_and_insert(**request.post_vars) > return 'NOTOK' if r.errors else str(r.id) > else: raise HTTP(400) > > even better you should return JSON objects (for example return > response.json(r.errors)). > &

[web2py] Controller wont return submitted row id

2014-08-01 Thread desta
Hello everyone, I have this controller which is called through AJAX and submits data to the form. The data is successfully transmitted but when I try to return the submitted row id the controller returns nothing. def addsample(): formSample = SQLFORM(db.sample, _class='form-horizontal', fo

[web2py] Re: Custom login form - How to detect login failure?

2014-02-17 Thread desta
I am just reporting back to say that using if response.flash == auth.messages.invalid_login: as Anthony suggested worked. I don't find it very elegant but hey it works! Thanks again! On Sunday, February 16, 2014 6:20:00 PM UTC+2, Anthony wrote: > > On Sunday, February 16, 2014 11:07:21 AM UTC-

[web2py] Re: Form format to match specific theme (bootsrtap)

2014-02-16 Thread desta
define in a model file. > > Anthony > > On Saturday, February 15, 2014 11:09:39 AM UTC-5, desta wrote: >> >> Thank you Anthony. >> >> If I create my custom function, where should it be located? In the >> /gluon/sqlhtml.py? >> >> Thanks aga

[web2py] Re: Custom login form - How to detect login failure?

2014-02-16 Thread desta
e login fails. If you want to use > auth.login(), upon login failure, it automatically redirects back to the > login page and displays a flash message. You can customize the flash > message via auth.messages.invalid_login. > > Anthony > > On Saturday, February 15, 2014 11:32

[web2py] Custom login form - How to detect login failure?

2014-02-15 Thread desta
Hello, I am building a custom *Login *form and I want to warn the user if his/her username/pass are wrong. How can I detect this? I tried through *form.errors* but its not there. I can understand that since its not error of the form but of authentication. Thank you. -- Resources: - http://we

[web2py] Re: Form format to match specific theme (bootsrtap)

2014-02-15 Thread desta
> customize any SQLFORM: > http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms > > Anthony > > On Saturday, February 15, 2014 5:09:55 AM UTC-5, desta wrote: >> >> Hello everyone, >> I am progressing well with my first application

[web2py] Form format to match specific theme (bootsrtap)

2014-02-15 Thread desta
Hello everyone, I am progressing well with my first application in web2py! At this point I need to apply the view theme. The chosen theme is based on the newest version of bootstrap. My question: Is there a way to change the format of the automatically generated forms to match that of the theme?

[web2py] Re: Install in hostgator

2014-01-31 Thread desta
I am writing to update this method. We have followed the instructions included above but we kept getting an internal server error 500. The problem was that we had no experience how virtualenv works! So first you need to create one with the following command: virtualenv /home//python The problem

Re: [web2py] Using "Homemade task queues"

2014-01-31 Thread desta
Thank you Tim, now I think I get it! I was confused because I thought that every time I wanted to run a background task I had to run that python command. Thanks again! On Friday, January 31, 2014 8:19:47 AM UTC+2, Tim Richardson wrote: > > > > On Friday, 31 January 2014 08:43:29 U

Re: [web2py] Using "Homemade task queues"

2014-01-30 Thread desta
r', 'tgz', > '.tar.gz', '.tar.bz', '.tar.xz', '.tar.bz2']): > scheduler.queue_task(untar,pvars=dict(filename=row.up_file, > username=row.username, folder=request.folder, > real_filename=row.filename, id=row_id)) > >

[web2py] Using "Homemade task queues"

2014-01-30 Thread desta
Hello everyone, A user uploads a file through a form and I want to process it using an external python script. I read from the manual about the Homemade task queues (http://web2py.com/books/default/chapter/29/04#Homemade-task-queues). I understand how it works. What I am missing is how to actu

Re: [web2py] How to start external python script from my web2py controller (Solution needed as soon as possible )

2014-01-26 Thread desta
This in an interesting approach. What would be a proper way to implement this? I imagine that a controller in web2py populates a queue. And you need another python script to check this queue, which is stored in a table in the db, and execute them. Would this python script be an external to web2

[web2py] Re: Form validation - Either choose from the dropdown or upload a file

2014-01-26 Thread desta
gt; Field('your_file', 'upload', requires=IS_NOT_EMPTY() if not > request.vars.your_data else None)) > form.process() > > On Saturday, 25 January 2014 07:56:23 UTC-6, desta wrote: >> >> Hello, I am a complete beginner building my first web applicati

[web2py] Form validation - Either choose from the dropdown or upload a file

2014-01-25 Thread desta
Hello, I am a complete beginner building my first web application with web2py. I have a form that displays a dropdown list and also has a file upload option. I want the user to do one of the two. Either choose an entry from the list or upload a file. I cannot figure out a way to do it with vali