GithubHelp home page GithubHelp logo

Comments (5)

niphlod avatar niphlod commented on July 4, 2024

From [email protected] on February 07, 2012 09:20:46

can you send me a patch?

from web2py.

niphlod avatar niphlod commented on July 4, 2024

From [email protected] on February 07, 2012 09:22:30

I see you posted the patch. thanks in the next issue.

Status: Duplicate

from web2py.

niphlod avatar niphlod commented on July 4, 2024

From [email protected] on February 08, 2012 12:36:48

This is not a duplicate of 649.

The patch for #649 does not solve the default "requires" issue being wrong, as the form constraints have already been generated for the original (non existant table), and you need to put requires=[] on the original unique column or the sqlform / app admin has an exception when trying to validate inserted records.

I think the only way to really solve this issue is to copy the original "requires" of the field, and when copying a table, use the original requires (not the already set-up requires as is done now, which already has the wrong value), which will get expanded correctly. I would have done this patch, but it is in parts of the DAL I'm not yet feeling comfortable modifying -- I might do that in the next few weeks.

(Also, if that is being done, I suggest adding a "selfref" column type, which will expand to reference the current table, which is a cleaner solution than the current 649 patch, as it is never ambiguous -- but it only works if copying the original field type is done first, as is suggest in this issue)

from web2py.

niphlod avatar niphlod commented on July 4, 2024

From [email protected] on March 12, 2012 13:05:46

Status: Accepted

from web2py.

niphlod avatar niphlod commented on July 4, 2024

From [email protected] on September 11, 2012 14:33:43

Not sure if connected, but Unique does not work here (at least for Sqlite) ...

db.define_table('test', Field('name'), Field('person_id', 'reference person', unique=True))

In theory this would provide a constraint for a 1-1 relationship. Not a popular thing to do, but I guess it should still work, or documented that it doesn't.

from web2py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.