[web2py] Re: I'm really struggling - Upload file, parse out variables, display in a table.

2013-12-27 Thread Simon Ashley
Failing any other replies, this is what we do: 1. copy the file to the server (read then write; we get the files first and store them natively, outside a db, for later batch processing ) 2. use ElementTree to parse the file to get a decent dict 3. use the dict in a bulk_insert

[web2py] Re: Update on multiple tables with one form

2013-12-27 Thread Matheus Cardoso
I've tried the Anthony's idea and it worked, with one difference, though: the id could not be any value. It just worked putting the id with the same value of request.arg(0). I think that has some relation with the hidden input in custom forms where you have to put the id of the instance that

[web2py] Re: trying to add a submit button to SQLFORM but it does nothing

2013-12-27 Thread Tim Richardson
There is nothing wrong with the HTML generated by web2py. Browsers don't like it though, too many forms perhaps. Or nested forms. On Tuesday, 24 December 2013 09:39:36 UTC+11, Tim Richardson wrote: def test_form(): grid = SQLFORM.grid(db.person,

[web2py] Re: I'm really struggling - Upload file, parse out variables, display in a table.

2013-12-27 Thread Brando
Simon, could you share your code or possibly provide a w2p app? Thanks for the reply. On Friday, December 27, 2013 3:29:51 AM UTC-8, Simon Ashley wrote: Failing any other replies, this is what we do: 1. copy the file to the server (read then write; we get the files first and store

[web2py] Re: Drop down not showing

2013-12-27 Thread Michel Hayek
Please any help guys? -- *This e-mail is confidential and may also be privileged. If you are not the intended **recipient, please notify the sender immediately, delete it from your system and do **not copy, disseminate, distribute or disclose any information contained therein.* --

[web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Hi, I'm doing something like that: if auth.user: my_org = db(db.t_org_members.f_org_member == auth.user.id).select(db.t_org_members.f_org_rep) if my_org: for m in my_org: my_org_members = db(db.t_org_members.f_org_rep ==

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Jonathan Lundell
On 27 Dec 2013, at 9:53 AM, Avi A aviavi...@gmail.com wrote: Hi, I'm doing something like that: if auth.user: my_org = db(db.t_org_members.f_org_member == auth.user.id).select(db.t_org_members.f_org_rep) if my_org: for m in my_org:

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Thanks, I wasn't wrong, this is what I need: {{for member in org_member_data:}} what do you mean by: org_member_data is set to a single member's data, so it ends up with the last one it was set to. ? or: or perhaps collect org_member_data instances in a list? i return it as a dict or as

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Jonathan Lundell
On 27 Dec 2013, at 10:23 AM, Avi A aviavi...@gmail.com wrote: Thanks, I wasn't wrong, this is what I need: {{for member in org_member_data:}} what do you mean by: org_member_data is set to a single member's data, so it ends up with the last one it was set to. ? or: or perhaps collect

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Alright, I see what you mean. I'll give it a try. Thanks. On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote: On 27 Dec 2013, at 10:23 AM, Avi A avia...@gmail.com javascript: wrote: Thanks, I wasn't wrong, this is what I need: {{for member in org_member_data:}} what

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
for case my_org is empty i wrote: if my_org: not good enough? (if not empty?) On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote: On 27 Dec 2013, at 10:23 AM, Avi A avia...@gmail.com javascript: wrote: Thanks, I wasn't wrong, this is what I need: {{for member in

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Jonathan Lundell
On 27 Dec 2013, at 10:53 AM, Avi A aviavi...@gmail.com wrote: for case my_org is empty i wrote: if my_org: not good enough? (if not empty?) If that happens, what does the view see? On Friday, December 27, 2013 8:37:55 PM UTC+2, Jonathan Lundell wrote: On 27 Dec 2013, at 10:23 AM, Avi A

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
user logged in the view: if he is in a group: till now he will see the group members' data and take some action later on. else: will sign up for a group. after page refresh will see the group members' data. (will have a different page for modifying subscription.) On Friday, December 27, 2013

[web2py] Re: building model at run-time?

2013-12-27 Thread Tim Richardson
You may not realise it perhaps, but when defining models for legacy tables, you don't need to define every field, just the ones you use. The amount of work required in constructing your models may not be as much as you think. Read about lazy tables: these mean that the table definition is only

Re: [web2py] Re: links in texts stoded in a database

2013-12-27 Thread Jonas Fredriksson
I tried ckeditor and I've got an editor in admin so I can insert links, so far so good. but the text is still rendered plain with html tags visible. my function and db in db.py: (text field is the field I want to insert links into) def advanced_editor(field,text): return TEXTAREA(_id =

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
Now I am able to get the list as you suggested with append. But i don't know how to render it. This is what I try in the view but it says that NameError: name 'auth_user' is not defined: {{for member in org_member_data:}} option{{=member[auth_user.email]}}/option {{pass}} On Friday,

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Jonathan Lundell
On 27 Dec 2013, at 2:20 PM, Avi A aviavi...@gmail.com wrote: Now I am able to get the list as you suggested with append. But i don't know how to render it. This is what I try in the view but it says that NameError: name 'auth_user' is not defined: {{for member in org_member_data:}}

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
member.auth_user.email throws the same error. auth_user.email is defined in the select on the controller, as far as i understand, among other fields from the auth user table.. On Saturday, December 28, 2013 12:35:54 AM UTC+2, Jonathan Lundell wrote: On 27 Dec 2013, at 2:20 PM, Avi A

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Jonathan Lundell
On 27 Dec 2013, at 2:42 PM, Avi A aviavi...@gmail.com wrote: member.auth_user.email throws the same error. auth_user.email is defined in the select on the controller, as far as i understand, among other fields from the auth user table.. It's not. Try member.email. If that doesn't work, just

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
yes i tried that one too. {{=member}} renders inside each option atable with expected data: tabletheadtrthauth_user.phone_num/ththauth_user.car_num_0/th thauth_user.email/ththauth_user.profile_image/thth auth_user.first_name/ththauth_user.last_name/th/tr/theadtbodytr

[web2py] Re: I'm really struggling - Upload file, parse out variables, display in a table.

2013-12-27 Thread Simon Ashley
A little difficult to share to code (done for a client, its similar and but not exactly what you're doing i.e. maybe a lot more complicated than what you need), but I think you're almost there. You need to upload the files to the server, then parse them to get each dict. My understanding is

[web2py] Re: trying to add a submit button to SQLFORM but it does nothing

2013-12-27 Thread Massimo Di Pierro
You cannot have a grid in a form because a grid contains a form. Nested forms are not allowed in html. Massimo On Monday, 23 December 2013 21:16:52 UTC-6, Tim Richardson wrote: This works: grid_form =

Re: [web2py] only last item on the dict is rendered.

2013-12-27 Thread Avi A
I created a dict instead of a list and I'm getting there...thanks. On Saturday, December 28, 2013 12:44:09 AM UTC+2, Jonathan Lundell wrote: On 27 Dec 2013, at 2:42 PM, Avi A avia...@gmail.com javascript: wrote: member.auth_user.email throws the same error. auth_user.email is defined in the

[web2py] Re: I'm really struggling - Upload file, parse out variables, display in a table.

2013-12-27 Thread Brando
I think i'm pretty close to understanding. I still have a few questions here: *1. You need to upload the files to the server, then parse them to get each dict. * The code I have to generate my dictionaries follows this format (let's assume there are 3 different config formats):

[web2py] Re: I'm really struggling - Upload file, parse out variables, display in a table.

2013-12-27 Thread Simon Ashley
1. We just do it in the controller as a function . Try an .insert but .bulk_insert should be fine for individual records. 2. You may need a path to find the file. Following code is cut, pasted and sanitised from a working controller. (for illustration only) ## initiates getting

[web2py] Re: Drop down not showing

2013-12-27 Thread Massimo Di Pierro
It is hard to help. You posted lots of code. Your traceback mentions model (or field) use_company but you did not post this model. ValueError: invalid literal for long() with base 10: 'user_company' Can you post a minimal action to reproduce the problem? Can you reproduce the problem if you

[web2py] Login form on index page

2013-12-27 Thread Unnikrishnan Patel
Hi , i am new at web development with web2py , I want to add login or signup form on the index page itself , i tried to go through the codes but its quite tough to figure out , can anyone please help me with that? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] link as virtualfield

2013-12-27 Thread Diego Tostes
Hi, I am trying to create a virtualfield as a link like the this code: http://pastebin.com/c2wZqECH But when i create a SQL.grid this virtualfield is displayed as a string. Is it possible to create a link ? Rgds, Diego -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] save upload filename in database

2013-12-27 Thread Calvin Morrison
I'm following the documentation trying to figure out how to correctly save a filename to my uploads database. Basically i have the same code as the website shows in it's examples def submit(): import datetime form = SQLFORM(db.uploads, fields=['up_file', notes], deletable=True)

[web2py] web2py on heroku getting InternalError: current transaction is aborted... Ticket

2013-12-27 Thread Ismael Serratos
Hello everybody, today I tried to push my application to Heroku by using the setup-web2py-heroku.sh script. It works fine, but when opening my app I get a ticket with this content: web2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 2.7.4: /app/.heroku/python/bin/python

[web2py] Re: save upload filename in database

2013-12-27 Thread Massimo Di Pierro
Let's isolate the problem. Are you saying that even if you have this: Field('up_file', 'upload', uploadseparate=True, requires =[IS_NOT_EMPTY(), IS_UPLOAD_FILENAME(extension=ext_regex)]), You can submit a form that does not upload a file into up_file? On Thursday, 26 December 2013 13:21:35

[web2py] Re: Login form on index page

2013-12-27 Thread Massimo Di Pierro
You can insert def index(): form = auth.login() if auth.user: message=welcome %s % auth.user.first_name else: message = 'login please' return dict(form=form, message=message) and in view: ... {{=form}} {{=message}} ... On Thursday, 26 December 2013 13:39:07 UTC-6, Unnikrishnan

[web2py] Re: link as virtualfield

2013-12-27 Thread Massimo Di Pierro
try replace Field.Virtual('anexos', lambda row: a href=''Teste_%s/a % row.parte.id ) with Field.Virtual('anexos', lambda row: XML(a href=''Teste_%s/a % row. parte.id)) or Field.Virtual('anexos', lambda row: A('Teste_%s' % row.parte.id,_href='')) but you may also want to consider using this

[web2py] Re: web2py on heroku getting InternalError: current transaction is aborted... Ticket

2013-12-27 Thread Massimo Di Pierro
Is there any database log to help you? What are the queries being executed or failing? On Friday, 27 December 2013 22:45:24 UTC-6, Ismael Serratos wrote: Hello everybody, today I tried to push my application to Heroku by using the setup-web2py-heroku.sh script. It works fine, but when

[web2py] Re: web2py on heroku getting InternalError: current transaction is aborted... Ticket

2013-12-27 Thread Ismael Serratos
The only information that I get is this part of the traceback: (the error is generated since the first time the app launches) Function argument list (self=gluon.contrib.heroku.HerokuPostgresAdapter object, *a=('CREATE TABLE IF NOT EXISTS web2py_filesystem (path VARCHAR(255), content TEXT,

[web2py] Re: web2py on heroku getting InternalError: current transaction is aborted... Ticket

2013-12-27 Thread Ismael Serratos
Sorry for the spam :s, digging the heroku logs I get this: 2013-12-28T05:17:30.576403+00:00 app[web.1]: ERROR:web2py.dal:Could not retrieve applications/init/databases/bad0fba8494e4bab4e99ad1290bcc0d2_web2py_session_init.table 2013-12-28T05:17:30.576403+00:00 app[web.1]: if