Questions tagged [web2py]

web2py is a open-source full-stack web framework written in Python.

web2py is a free, open-source web framework for agile development of secure database-driven web applications; it is written in Python.

web2py is a full-stack framework. It includes an ORM (called the Data Abstraction Layer), its own template engine and typical form widget helpers and controls.

Created by a team of professionals and academics, one of its key principles is no backward incompatible changes. Development is led by Massimo Di Pierro, Associate Professor in Computer Science at DePaul University in Chicago.

Additional resources:

  1. Project Website
  2. Documentation
  3. Source Code
  4. Sample Websites
  5. Wikipedia Page
  6. Google Group

Simple Example (from What is web2py?):

Model Definition:

db=DAL('sqlite://storage.db')
db.define_table('image', 
    Field('name'),
    Field('file','upload'))

Controller:

def index():
    form = SQLFORM(db.image)
    if form.process().accepted:
        response.flash = 'image uploaded'
    return dict(form = form,counter=None,_class='boxCode')

View:

{{extend 'layout.html'}}
<h1>Image upload form</h1>
{{form}}
2141 questions
3
votes
1 answer

Modifying SQLFORM text output - line breaks, paragraphs (web2py framework)

Model: Field('text1', type='text', length=1000, notnull=True) Function: def textinput(): f=SQLFORM(db.example, fields=['text1']) if f.accepts(request.vars, session): return dict(form=f) I want to be able to display the 'text1' field with proper…
samer.j92
  • 85
  • 1
  • 7
3
votes
1 answer

Immediately start ajax call if other one is still running

Assuming I start a looping function via ajax that waits a response from a device (in this case a barcode reader), I need to do an other ajax call if a "Back" button is pressed (while the first function is still running). How could it be done? Using…
3
votes
2 answers

Record user voice from web browser

I am simulating something similar to Google Chrome's voice recognition plugin. I wish to record voice from web browser and send it to server for processing. In short, I wish to do as described in Accessing Google Speech API / Chrome 11. I have…
rahulserver
  • 10,411
  • 24
  • 90
  • 164
3
votes
3 answers

How can I make SQLTABLE results link to outside pages?

New to Web2py, so my question might not be too clear. I'm trying to make a shipment tracking page, and I have a simple database with a tracking number and a shipper ID. Following the examples, my application can display and add new records to the…
user1011625
  • 121
  • 2
  • 10
3
votes
1 answer

web2py CRUD.create() field representation in forms

i have this field for example Field('yourref', type='string', label=T('Your reference')), which is shown as an INPUT in the HTML i want to show it like this
Elteroooo
  • 2,913
  • 3
  • 33
  • 40
2
votes
2 answers

Default user group creation behavior in web2py

While reading the web2py manual, I came across this following: 'Once a new user is registered, a new group is created to contain the user. The role of the new user is conventionally "user_[id]" where [id] is the id of the newly created…
skyork
  • 7,113
  • 18
  • 63
  • 103
2
votes
2 answers

composite key in web2py

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…
Ashish
  • 851
  • 12
  • 27
2
votes
1 answer

How can I prevent web2py from automagically encoding html-entities?

I'm trying to print out HTML generated for user-submitter markdown, by {{=markdown(post.message)}} where markdown function is imported through from gluon.contrib.markdown.markdown2 import markdown We2Py seems to automatically encode HTML-Entities,…
S P
  • 1,801
  • 6
  • 32
  • 55
2
votes
3 answers

Modify column output for sqlform.grid() in Web2py

I have started using web2py for a web application and try to use SQLFORM.grid(...) to display a paginated listing of one of my db-table's data like in the following minimal example. grid=SQLFORM.grid(query, links=links, …
florianletsch
  • 465
  • 4
  • 16
2
votes
1 answer

Is it possible to add custom methods to Web2Py's builtin "models"?

Is it correct, that in Web2Py you are not able to create custom methods within "models", so that they could contain business logic you want models to implement? In case of Django you can just do something like: class Aircraft(models.Model): '''I…
Tadeck
  • 132,510
  • 28
  • 152
  • 198
2
votes
1 answer

The part of the view after an `extend` statement is not rendered

I'm trying to use the extend keyword to add a comment-box (a view placed under default/comment_box.html) across several of my views, by: ...
{{extend "default/comment_box.html"}} ... But, when this executes, all the part of…
S P
  • 1,801
  • 6
  • 32
  • 55
2
votes
1 answer

ValueError when accessing a Table after inserting a ROW object to list:reference field

I am getting a ValueError for the DAL query db(db.posts.id == request.vars["post"]).select().first(), with the following TraceBack: Traceback (most recent call last): File "E:\Programming\Python\web2py\gluon\restricted.py", line 204, in…
S P
  • 1,801
  • 6
  • 32
  • 55
2
votes
1 answer

New table is not recognized

I've added a new table to my Web2Py app: db.define_table('users', db.Field('name', 'string'), db.Field('password', 'password'), db.Field('reputation', 'integer', default=0), db.Field('joined', 'datetime',…
S P
  • 1,801
  • 6
  • 32
  • 55
2
votes
1 answer

web2py: modify widget in crud form

I have a CRUD form that has a select widget. The options in the widget are dynamic. I cannot use tags, as the values are coming from other tables. I am trying to change the values in the controller using this method: def change_widget(form, id,…
naveed
  • 1,395
  • 2
  • 15
  • 29
2
votes
0 answers

Forms not working with web2py in Chrome

I'm new to web2py and following the book, I'm trying to follow along with the 3rd Chapter building the images application http://web2py.com/books/default/chapter/29/3#An-image-blog, I'm faced with a problem after building the model and trying to add…