web2py

composite key in web2py

无人久伴 提交于 2019-12-01 00:30:29
I have a table defined in web2py db.define_table( 'pairing', Field('user',writable=True,readable=True), Field('uid', writable=True , readable=True) ) This table needs to have user and uid combination being unique. I have looked through the web2py documentation , but there isn't direct way to define composite key . How do we define composite way in web2py It depends on what you are trying to do. By default, web2py automatically creates an auto-incrementing id field to serve as the primary key for each table, and that is the recommended approach whenever possible. If you are dealing with a

composite key in web2py

天涯浪子 提交于 2019-11-30 20:16:47
问题 I have a table defined in web2py db.define_table( 'pairing', Field('user',writable=True,readable=True), Field('uid', writable=True , readable=True) ) This table needs to have user and uid combination being unique. I have looked through the web2py documentation , but there isn't direct way to define composite key . How do we define composite way in web2py 回答1: It depends on what you are trying to do. By default, web2py automatically creates an auto-incrementing id field to serve as the primary

representation format in web2py database

╄→尐↘猪︶ㄣ 提交于 2019-11-30 13:43:58
db.define_table('person', Field('name'), format='%(name)s') What does this format do here? The format argument is used to determine how fields in other tables that reference the 'person' table will be displayed. For example, if you define: db.define_table('dog', Field('name'), Field('owner', db.person) The 'owner' field is a reference field that references the 'person' table (i.e., it stores record id's of records from the 'person' table). In most cases, when you display data from the 'dog' table, you don't want to display the raw db.person record id that is stored in the 'owner' field because

Django, Turbo Gears, Web2Py, which is better for what?

痴心易碎 提交于 2019-11-30 11:27:56
问题 I got a project in mind that makes it worth to finally take the plunge into programming. After reading a lot of stuff, here and elsewhere, I'm set on making Python the one I learn for now, over C# or java. What convinced me the most was actually Paul Graham's excursions on programming languages and Lisp, though Arc is in the experimental stage, which wouldn't help me do this web app right now. As for web app fast, I've checked out Django, Turbo Gears and Py2Web. In spite of spending a lot of

Django, Turbo Gears, Web2Py, which is better for what?

我只是一个虾纸丫 提交于 2019-11-30 01:05:10
I got a project in mind that makes it worth to finally take the plunge into programming. After reading a lot of stuff, here and elsewhere, I'm set on making Python the one I learn for now, over C# or java. What convinced me the most was actually Paul Graham's excursions on programming languages and Lisp, though Arc is in the experimental stage, which wouldn't help me do this web app right now. As for web app fast, I've checked out Django, Turbo Gears and Py2Web. In spite of spending a lot of time reading, I still have no clue which one I should use. 1) Django certainly has the nicest online

Django vs web2py for a beginner developer [closed]

纵饮孤独 提交于 2019-11-28 15:12:17
Which of these two frameworks is better suited to a developer with 11 months experience. I have decided to learn python for my server side coding and wanted to know which of these would be better suited for someone at my skill level. I have just spent a few days playing around with web2py and really like it and i am wondering if Django offers something more that i am missing out on? PS. UPDATE: Thank you all for the wonderful input, after buying three django books and going through a few small projects/tutorials for both django and web2py, i have settled on web2py. This is a wonderful

Best practice for populating dropdown based on other dropdown selection in web2py?

不打扰是莪最后的温柔 提交于 2019-11-27 23:15:40
I would like to create a form that contains dropdown fields. After entering text or selecting an option in one dropdown I would like to populate the options in another. Is there a best practice for doing so specifically with web2py? Check out this lazy options widget (with usage example ) as well as these recipes: Cascading Drop Down Lists Cascading Select Based on Python Lists Cascading Drop Down Lists with Ajax 来源: https://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p

How can I use modules in web2py?

≯℡__Kan透↙ 提交于 2019-11-27 13:53:19
问题 I have some functions in func.py that I would like to access from my web2py controller called default.py . I tried to import and use func.py in default.py with "import func" and "calculatesomething = func.calculatesomething", but it doesn't work. The file func.py is also added in the Modules section of my web2py program. Why it is not working? How can I make it to work? Should the module be in func.py or default/func.py or something else? 回答1: func has to be in a place that is in PYTHONPATH

Django vs web2py for a beginner developer [closed]

帅比萌擦擦* 提交于 2019-11-27 09:04:16
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Which of these two frameworks is better suited to a developer with 11 months experience. I have decided to learn python for my server

Best practice for populating dropdown based on other dropdown selection in web2py?

谁说胖子不能爱 提交于 2019-11-26 23:19:15
问题 I would like to create a form that contains dropdown fields. After entering text or selecting an option in one dropdown I would like to populate the options in another. Is there a best practice for doing so specifically with web2py? 回答1: Check out this lazy options widget (with usage example) as well as these recipes: Cascading Drop Down Lists Cascading Select Based on Python Lists Cascading Drop Down Lists with Ajax 来源: https://stackoverflow.com/questions/8146260/best-practice-for-populating