Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7946333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:07:09+00:00 2026-06-04T01:07:09+00:00

From a logical perspective it sometime doesn’t make sense, for example, to add an

  • 0

From a logical perspective it sometime doesn’t make sense, for example, to add an Address before you add a Customer.

db.define_table('address',
   Field('line1','string', required=True),
   Field('line2','string'),
   Field('suburb','string', required=True),
   Field('post_code','integer'),
   Field('email','string')
)

db.address.post_code.requires = IS_INT_IN_RANGE(0000, 9999)
db.address.email.requires     = IS_EMAIL()

db.define_table('customer',
   Field('name', 'string', required=True, unique=True),
   Field('locations', 'list:reference db.address', required=True),
   Field('comment', 'string')
) # quick aside: how would I ensure there isn't another customer with same name+location?

db.address.requires = IS_IN_DB(db, db.address, '%(line1)s' + ', ' + '%(suburb)s', multiple=True)

So if I could generate one form that allows you to create a customer, complete with address, the management would become much more logical.

However it would still be useful to be able to pick from records already in the db, but to just have an “Add” button—rolling down with javascript—which will open by default if field is empty (and .requires not to be).

How would I generate this nested CRUD?

Thanks for all suggestions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:07:11+00:00Added an answer on June 4, 2026 at 1:07 am

    I believe that this topic in the official book covers it somewhat:

    http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables

    Basically, you have to use sqlform.factory. Your controller will call the insert on the address first, then get that ID for the address, and then using that ID, call the insert on the customer.

    That handles your adds, but not a dropdown, unfortunately. You would need to write your own html as far as that’s concerned. No automatic CRUD.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a parser to be able to extract logical structure from
I want to filter rows from a data.frame based on a logical condition. Let's
I'm studying The C++ Programming Language from Bjarne Stroustrup and he talks about logical
I have a report that needs to get data from two logical areas of
From another forum I found the following example: I was looking for a way
From a logical point of view an application may need dozens or hundreds of
From what I gather, Linq to SQL doesn't actually execute any database commands (including
I've read the definition of logical reads from: http://msdn.microsoft.com/en-us/library/ms184361.aspx it says: Number of pages
I'm a bit confused from what I've heard Java doesn't do events. But I
Picking up a tip from someone else on this site, I've been using logical

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.