[web2py] Re: Using the ajax function with the built-in form function

2014-02-02 Thread raferbop
')) > return dict(form=form) > > def total_cost(): > price = request.vars.price > quantity = request.vars.quantity > total = int(price) * int(quantity) > return str(total) > > Views: > > {{=form}} > > > > jQuery('input[name=price]'

[web2py] Using the ajax function with the built-in form function

2014-02-02 Thread raferbop
The web2py book uses the following example to demonstrate how to call the ajax function in the views page. *Controller*: def one(): return dict() def echo(): return request.vars.name *Views:* {{extend 'layout.html'}} However,I would like to know what modifications to above

Re: [web2py] fetching db records with request.args(0)

2013-12-06 Thread raferbop
Thanks viniciusban, request.vars.id did the trick. On Friday, December 6, 2013 11:16:04 AM UTC-5, viniciusban wrote: > > You are sending vars to certificate and using args to retrieve the record. > > That's your problem. > > On Fri, Dec 6, 2013 at 2:10

[web2py] fetching db records with request.args(0)

2013-12-06 Thread raferbop
# View - country.html {{for people in country:}} Birth Certificate {{=(people.name)}} {{=(people.dob)}} {{=(people.height)}} {{pass}} # Controller def certificate(): certificate = db(db.poeple.id==request.args(0)).select() return locals() # View - certificate.html {{for row in ce

[web2py] How to display the value of a reference field, instead of the id.

2013-11-30 Thread raferbop
Good day Guys, How do you display the value of a reference field, such as the owner's name, in the dog table, instead of the owner.id (in the default/display_dogs page). #Model db.define_table('owner', Field('name')) db.define_table('dog', Field('ow

[web2py] Re: One of the best things that happened to web2py

2013-11-25 Thread raferbop
I moved my web2py development to https://www.pythonanywhere.com about 3 weeks ago, and I must say, its kicks AWS ass because its free! This is the perfect environme

[web2py] using SQLFORM.grid to update db tables

2013-11-25 Thread raferbop
db.define_table('owner', Field('name')) db.define_table('dog', Field('name'), Field('breed'), Field('owner', db.owner) db.define_table('sale', Field('dog', db.dog), Field('new_owner', db.owner),

Re: [web2py] name 'database table' is not defined

2013-11-23 Thread raferbop
Thanks Eduardo, it worked! On Saturday, November 23, 2013 9:26:17 AM UTC-5, Eduardo Cruz wrote: > > You are using 'animals' in the for loop not *livestock_animal*s, > instead of *livestock_animals* use animals like {{=animals.eartag_number}} > On Sat, 2013-11-23 at 06:18

[web2py] name 'database table' is not defined

2013-11-23 Thread raferbop
# Model db.define_table('livestock_animals', Field('eartag_number'), Field('retagged_number'), Field('dob', 'date'), Field('breed', db.breed), Field('sex', db.sex), Field('dam'), Field('

[web2py] Re: How to create a db query for data that has not been submitted to the database

2013-11-11 Thread raferbop
alues of the source > and destination. > > > On Sunday, 10 November 2013 15:55:34 UTC-6, raferbop wrote: >> >> Good days guys, >> >> I created an order form with the following fields (db.order); >> >>- Departure Location >>- Arrival Location

[web2py] Re: Form fields in DB showing a 0 value

2013-11-11 Thread raferbop
rgument > > > http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=autocomplete#Autocomplete-widget > > On Sunday, November 10, 2013 9:56:46 PM UTC+1, raferbop wrote: >> >> When I remove the auto complete widget, the data saves in the database is

[web2py] How to create a db query for data that has not been submitted to the database

2013-11-10 Thread raferbop
Good days guys, I created an order form with the following fields (db.order); - Departure Location - Arrival Location - Date I wanted to display fares between each departure and arrival location, so I created a fare table (db.fare_table); id depart_cityarrival_city far

[web2py] Re: Form fields in DB showing a 0 value

2013-11-10 Thread raferbop
When I remove the auto complete widget, the data saves in the database is it should. On Saturday, November 9, 2013 7:34:39 PM UTC-5, 黄祥 wrote: > > oopss, sorry didn't notice that you are using > SQLFORM.widgets.autocomplete, yes, it should. > basically the reference type of field is refer to pri

[web2py] Re: Form fields in DB showing a 0 value

2013-11-09 Thread raferbop
Stifan,Winvalid literal for long() with base 10: 'Montego Bay' On Saturday, November 9, 2013 4:03:15 PM UTC-5, 黄祥 wrote: > > please use format as record representation or set it on IS_IN_DB form > validation. > e.g. if you want to show city as a drop down menu in order_bus form : > db.define_table

[web2py] Form fields in DB showing a 0 value

2013-11-09 Thread raferbop
db.define_table( 'route', Field('city'), Field('country_iso')) db.define_table( 'order_bus', Field('depart_from', db.route), Field('arrive_to', db.route), Field('date', 'date'), Field('time', db.depature_times), # drop-down select time options Field('no_of_pa

[web2py] Auto-complete Error

2013-11-02 Thread raferbop
#Model db.define_table( 'order_cab', Field('pick_up', db.location, widget = SQLFORM.widgets.autocomplete(request,db.location.street_address,limitby=(0,10), min_length=2)), Field('drop_off', db.location, widget = SQLFORM.widgets.autocomplete(request,db.location.street

[web2py] jQuery autocomplete not working.

2013-11-01 Thread raferbop
Good day days guys, I implemented the following code below to enable auto-complete in a text field, but it doesn't work, can someone please tell me where I am going wrong; # Model Files # db.define_table( 'location', Field('street_address', type='string', label=T('Street Addre

Re: [web2py] Any good tutorials on how to implement auth_group, auth_membership & auth_permissions?

2013-10-29 Thread raferbop
trol > > Richard > > > On Tue, Oct 29, 2013 at 10:46 AM, raferbop > > wrote: > >> >> I am having a difficult time in understanding how to implement the above >> functions, and the chapter on authentication skims over the topic. Massimo >> ha

[web2py] Any good tutorials on how to implement auth_group, auth_membership & auth_permissions?

2013-10-29 Thread raferbop
I am having a difficult time in understanding how to implement the above functions, and the chapter on authentication skims over the topic. Massimo has some great examples in the appliances section, but I haven't come across an example that utilizes a many-to-many relationship with respect to

Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
> any pseudo or code that come to mind rapidly, but for sure you can find and >>> reuse code available here on the list... Also, there is a better appadmin >>> admi interface call badmin or badadmin, you could maybe find code for this, >>> or see how it is programme

Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
Richard, I was about to post a similar question, but let me just ask you. I am also new to web2py, and I am not able to find any good resources in relation to creating multiple groups or assigning roles to users. For example, lets say I have a group of users that I want to categorize as company

[web2py] Re: failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread raferbop
> automatically PCI compliant. > > > > On Monday, 21 October 2013 19:22:33 UTC-5, raferbop wrote: >> >> >> >> Good day Guys, >> >> I am currently trying to run the authorize.net credit processing >> example, but I am getting some indent

[web2py] failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread raferbop
Good day Guys, I am currently trying to run the authorize.net credit processing example, but I am getting some indentation errors with the following lines of code; if form.accepts(request,session): if process(form.vars.creditcard,form.vars.expiration, total,form.vars

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
gate analyses, such as > calculating number of sales per product). > > Anthony > > On Wednesday, October 16, 2013 8:03:14 PM UTC-4, raferbop wrote: >> >> Thanks Anthony, the default argument, which I am assuming is "default= >> auth.user_id", inserts the

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
Thanks Anthony, the default argument, which I am assuming is "default=auth.user_id", inserts the user id into the sales table. But what argument should I use to insert the sale_id into the products table, very much in the same way the default=auth.user_id inserst the user id in the db.sale.

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
urrency. Use instead Python > decimal which works as you expect decimal numbers to work. Or you could > store the, for example, US currency as pennies and put in the decimal > marker when you display the value and strip it out when you work with it on > the back end. > > Whatever come

[web2py] Re: one to many relationship DB structure

2013-10-16 Thread raferbop
Thanks Stifan, But that doesn't work either, because the product_id now displays in the sale form. I need to generate the sale_id first, and then have sow in the product table/form. Right now, it just shows up blank. On Wednesday, October 16, 2013 11:08:58 AM UTC-5, 黄祥 wrote: > > yeah, my pov

[web2py] one to many relationship DB structure

2013-10-16 Thread raferbop
db.define_table( 'auth_user', Field('id'), Field('first_name', type='string', label=T('First Name')), Field('last_name', type='string', label=T('Last Name')), Field('email', type='string', label=T('Email')), Field('password', type='password',

[web2py] Re: AttributeError: 'DAL' object has no attribute 'auth_user'

2013-10-13 Thread raferbop
Thanks Anthony, it took me a like a week to wrap my head around that. On Sunday, October 13, 2013 7:48:38 PM UTC-5, Anthony wrote: > > * >> Field('seller_id', db.auth_user, default=auth.user_id), >> * >> > > It looks like you are creating a reference to db.auth_user before that > table has b

[web2py] AttributeError: 'DAL' object has no attribute 'auth_user'

2013-10-13 Thread raferbop
* db = DAL('sqlite://storage.sqlite') db.define_table( 'product_car', Field('seller_id', db.auth_user, default=auth.user_id), Field('name', requires = IS_NOT_EMPTY()), Field('price', 'double', default=0.00), Field('description','text'), Field('image', 'upload', default=''),

[web2py] Invalid login

2013-10-10 Thread raferbop
#Controller Functions def form_a(): form = SQLFORM(db.person) if form.process(session=None).accepted: session.flash = 'form accepted' redirect(URL('index')) elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill out

[web2py] Re: 'SQLFORM' object has no attribute 'error'

2013-10-07 Thread raferbop
Thanks a lot lesssugar...it worked! On Monday, October 7, 2013 4:48:25 PM UTC-5, lesssugar wrote: > > Shouldn't it be *form.errors*? > > On Monday, October 7, 2013 11:20:32 PM UTC+2, raferbop wrote: >> >> # Model/db.py >> >> db = DAL('s

[web2py] 'SQLFORM' object has no attribute 'error'

2013-10-07 Thread raferbop
# Model/db.py db = DAL('sqlite://storage.sqlite') db.define_table( 'person', Field('name', requires=IS_NOT_EMPTY(error_message=auth.messages.is_empty )), Field('email', requires=IS_EMAIL(error_message=auth.messages. invalid_email)), Field('password', requires=[IS_STRONG(), CRYPT()

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-25 Thread raferbop
redirected to default/user.load/profile. These pages have no formatting On Tuesday, September 24, 2013 3:46:31 PM UTC-5, Massimo Di Pierro wrote: > > I have never tried this but I am not sure you can have those forms in the > same page. Apart for the incorrect redirect, do they both w

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-24 Thread raferbop
On Tuesday, September 24, 2013 1:09:51 PM UTC-5, raferbop wrote: > > def index(): >return dict(logform=auth.login(),regform=auth.register()) > > I put these two forms from the Auth module on the index page, inside a > modal but when I login/register I am redirected to a pr

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-24 Thread raferbop
On Tuesday, September 24, 2013 1:09:51 PM UTC-5, raferbop wrote: > > def index(): >return dict(logform=auth.login(),regform=auth.register()) > > I put these two forms from the Auth module on the index page, inside a > modal but when I login/register I am redirected to a pr

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-24 Thread raferbop
ser_form input:visible:enabled:first").focus(); //--> On Tuesday, September 24, 2013 3:46:31 PM UTC-5, Massimo Di Pierro wrote: > > I have never tried this but I am not sure you can have those forms in the > same page. Apart for the incorrect redirect, do they both work? &

Re: [web2py] Auth modal redirects to profile instead of index

2013-09-24 Thread raferbop
Thanks Richard, I just tried it but it seems to have been ignored and Im still being redirected to /default/user/profile -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Rep

[web2py] Auth modal redirects to profile instead of index

2013-09-24 Thread raferbop
def index(): return dict(logform=auth.login(),regform=auth.register()) I put these two forms from the Auth module on the index page, inside a modal but when I login/register I am redirected to a profile page instead of the index page. What can I do to prevent the redirect or go the index pag

[web2py] An ExtendedLoginForm with facebook

2012-06-19 Thread raferbop
I used the code from the book(Full Stack Web Framework, 4th Ed) to create a facebook login successfully, but that code disabled the default login form. I tried to use ExtendedLoginForm but i got this error: 'FaceBookAccount' object has no attribute 'login_form'' Is there another way to keep the