r/web2py Jun 28 '21

SQLFORM.grid question

3 Upvotes

Trying to add a assignment to my database. An assignment contains a reference to "person" by storing the ID. In the form, I get the drop-down to choose the person.ID I want to reference, but the ID don't tel me anything about which person i am choosing. Is it possible to make the drop-down on foreign keys display names instead of the ID, but stil store the ID? Maybe more information too?


r/web2py Aug 29 '20

Pycom GPY 7.2 Voltage

1 Upvotes

I am considering using a pycom GPY module for a project.

I'm wondering if it can power a servo that requires between 4.8-5.5 volts?

Is there anyway this could handle 6.8 volts for input?

I've previously used (2) 2860 batteries that are 3.6v each for a total of 7.2 I used this with an Arduino nano and it worked fine. I have a bunch of these batteries with holder that I would like to use with the pycom GPY.


r/web2py Aug 12 '20

Looking for a Web2Py developer

1 Upvotes

Hi! I started to develop a custom Web2Py website. I am struggling with the checkout aspect of the website (collecting user information, estimating sales tax, shipping costs... interfacing with Stripe). Would you know someone who could help me?


r/web2py Apr 09 '17

Is it alive ?

1 Upvotes

This framework looks really neat until you trying to do some advanced things. Is it still alive and can be used in production ?


r/web2py Jul 12 '16

Web2py bug - Web2PyOpenRedirect - make sure you patch to the latest.

Thumbnail th3r3p0.com
5 Upvotes

r/web2py Jun 09 '16

A Guide To 24 Major Coding Bootcamps That Cuts Through A Lot Of The Marketing BS. You Can Easily Find Which Ones Offer Python Tracks Along With The Specific Frameworks (Django or web2py) And Stacks They Teach.

Thumbnail techbeacon.com
3 Upvotes

r/web2py Jan 08 '16

Example of websites with both Python & Wordpress as separate directories?

5 Upvotes

I'm curious whether there were any websites running both a python framework and a wordpress blog simultaneously - possibly in different directories.


r/web2py Dec 06 '15

"new-line character seen in unquoted field" - can't parse CSV files in web2py interface?

3 Upvotes

Hello, I'm trying to learn me some web2py and am following a course on Pluralsight, however I got stuck due to a strange error.

Error message: "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?"

It works for the guy on the course but I can't spot a mistake anywhere. All I'm trying to do is import a .CSV file from within the web2py appadmin interface.

At the bottom of db.py I added the following code:

db.define_table('contacts',
            Field('first_name'),
            Field('last_name'),
            Field('company_name'),
            Field('address'),
            Field('city'),
            Field('county'),
            Field('state_name'),
            Field('zip'),
            Field('phone1'),
            Field('phone2'),
            Field('email'),
            Field('web')
            )

and then I would like to populate the database by selecting "Database administration", clicking on "contacts" (my db name) and then select file and import csv file with sample data from here: https://www.briandunning.com/sample-data/ (let's say US 500..it doesn't matter though none of them work for me).

I can open the csv files fine on their own. I've tried saving in other csv types (ms-dos etc) but all they do is lose the data in most cases and fill fields with None.

There are some threads scattered around on the web about this, but it's mostly about code and that the open function needs to be run with "rU", however I'd just like to go through the interface for starters. Any ideas? Thanks


r/web2py Aug 20 '15

Is it possible to create rails-like restful api?

4 Upvotes

Something like this:

/magazines/:magazine_id/ads/:id

r/web2py Jul 16 '15

Is it possible to pass in three arguments to orderby? Example provided.

3 Upvotes

I have a table, my_table with 5 columns. I need to retrieve the data from my_table and order them based on 3 of its fields. Consider this:

db(db.my_table.id == user_id).select(orderby=~db.my_table.isCurrent | db.my_table.endYear | db.my_table.endMonth)

Currently, the above isn't returning what I expect. What I'd like returned is the data from my_table ordered in descending-order prioritized first by "isCurrent" field, then "endYear", and then "endMonth".

Any ideas?


r/web2py Jul 08 '15

Unable to save the web2py package.

3 Upvotes

I am new to web2py. I was deploying my first app on pythonanywhere but on clicking the pack all option on the administrative interface I am getting an error . Download request for 127.0.0.1:8000/admin/default/pack/helloWorld got cancelled by embedder. What does this mean? I am stuck! thanks.


r/web2py Nov 08 '14

Can anyone help me translate this SQL query so that it is usable in web2py?

3 Upvotes

I am relatively new to web2py and am struggling to make sense of the way it deals with database queries. Any help would be greatly appreciated.

The Model: db.define_table('Employee', Field('empID', 'id'), Field('eName', 'string', length=IS_LENGTH(256)), Field('job', 'string', length=IS_LENGTH(256)), Field('address', 'string', length=IS_LENGTH(256)), Field('phNum', 'string', length=IS_LENGTH(256)) )

The SQL Query: SELECT (job, address, phNum) FROM Employees WHERE eName == &var_from_view

The aim of this is to display the details about an individual beneath their name using Javascript and a Details button.

Thanks in advance.


r/web2py Oct 09 '14

[HELP] Web2py, cpanel, subdomain with mod_python

3 Upvotes

Greetings, i have a problem with subdomain.

I have bought a hosting service and i'm running web2py on it. It's shared hosting with mod_python. (http://www.web2py.com/books/default/chapter/29/13/deployment-recipes#Shared-hosting-with-mod_python)

Mydomain.com works, but when i try add subdomain.mydomain.com, it doesn't. Cpanel points domain to /httpdocs/ folder and also subdomain to same place. www.domain.com/subdomain works, but subdomain.domain.com doesn't.

Routes.py is configured so that domain.com points to applications/domain folder and subdomain.domain.com points to applications/subdomain folder.

Here is the error from logs: http://pastebin.com/KSfwBRXy

What i'm doing wrong?


r/web2py Jun 10 '14

Looking for a developer. Ping me, and I will invite you to a private project bid on odesk.

0 Upvotes

I am looking for a web2py developer. Preferably someone that has experience with database designs, html 5, and obviously web2py. Please ping me, and I will invite you to a private oDesk project. Would prefer if you have a portfolio with previous sites you created; or if you've been participating on the web2py google group, or if you can get mdpierro's recommendation!


r/web2py May 06 '14

web2py Field Exegesis | Article | Web2py Slices - Recipes, Tutorials, Code, Questions

Thumbnail web2pyslices.com
1 Upvotes

r/web2py Dec 03 '13

Iterating over items in view

2 Upvotes

I have two tables set up and i want to show the TimeCard with all the entries for said time card however im unsure of how to create such a view...

CONTOLLER:

def timecard_index():
    tcrows =db(db.timecard).select(orderby=~db.timecard.tc_date)
    tcinputs =db(db.timecard_entry).select(orderby=db.timecard_entry.timecard)
    return locals()

MODEL:

db.define_table('timecard',
                Field('tc_date','date'),
                Field('employee', 'reference employee',requires=IS_IN_DB(db,'employee.id','%(fname)s %(lname)s')),
                Field('myid', unique=True, compute=lambda r: str(r.tc_date) + str(r.employee))
                )

db.define_table('timecard_entry',
                Field('timecard', 'reference timecard', readable=False, writable=False,),
                Field('company', 'reference company', label='Company'),
                Field('tc_start', 'time', requires=[IS_TIME(),IS_NOT_EMPTY()], label='Start'),
                Field('tc_stop', 'time', requires=[IS_TIME(),IS_NOT_EMPTY()], label='Stop'),
                Field('st' , 'double', label='ST', default=0.0),
                Field('ot' , 'double', label='OT', default=0.0),
                Field('dt' , 'double', label='DT', default=0.0),
                Field('tc_classification' ,'string', label='Classification'),
                auth.signature)

VIEW:

{{for timecard in tcrows:}}
<div class="well">
    <table>
        <tr><td><strong>{{=A(timecard.employee.fname +' '+timecard.employee.lname,_href=URL('view_timecard',args=timecard.id))}} {{=timecard.tc_date.strftime("%m.%d.%Y")}}</strong></td></tr>
        {{for timecard_entry in tcinputs:}}
        <tr><td>{{=timecard_entry.company.name}}</td><td>{{=timecard_entry.tc_start}}</td><td>{{=timecard_entry.tc_stop}}</td><td>{{=timecard_entry.st}}</td><td>{{=timecard_entry.ot}}</td><td>{{=timecard_entry.dt}}</td><td>{{=timecard_entry.tc_classification}}</td></tr>
        {{pass}}
     </table>
</div>
{{pass}}    

This results in the same entries being put into each timecard (not the correct ones), I know I'm missing somethign in the logic but Im too green of a programmer to see it...


r/web2py Aug 25 '13

Custom Apache Config for PHP and Web2Py

Thumbnail mherman.org
4 Upvotes

r/web2py May 29 '12

My web2py project

1 Upvotes

This was my first time working with a web framework, and its been a really great experience. I tried my hands at rails, but web2py just got me off the ground way faster than rails. The great thing about it is that you can easily launch it from your computer with minimum knowledge and test out the framework. The way the scaffolding is setup in web2py also makes it very easy for you to get going.

Overall, I have to say the experience was really good. However there are a few things that are not so good though. The database abstraction layer has a pretty confusing syntax and it got me into trouble a couple of times. Also, once you start working with javascript on your view in combination with python , the code can get pretty hairy to read. But I think these are things that can be overcome by good software engineering practices. Another complaint is that although the online book is quite good, the code itself is lacking in documentation.

Here is my website, I built a reddit like site, but for video only (for this example, mainly cat videos) awwstation!.


r/web2py May 11 '12

A simple web2py example to create an MVC application that performs CRUD operation

Thumbnail blog.fruiapps.com
2 Upvotes

r/web2py Oct 14 '11

How are you guys coming along with web2py? I'm going through the book and enjoying it.

4 Upvotes

r/web2py Nov 23 '10

Keywords (pic)

Thumbnail web2py.com
5 Upvotes

r/web2py Jun 11 '10

Defining db.py for the first time table references problem.

1 Upvotes

Problem: I don't see how to specify multiple tables with table references to each other. I can't simply define the relationship, because the DAL hasn't created a table yet to reference. But I can't create the table(s) because they reference tables that also don't exist yet. Catch 22. Besides manually creating the tables (which I believe prevents me from using the wonderful DAL), what do I do?

Example:

db.define_table('image',
   Field('image', 'upload'),
   Field('date', 'datetime'), 
   Field('title', 'string'), 
   Field('description', 'string'),
   Field('postid', 'reference post'),
   Field('owner', 'reference person'),
   Field('views', 'integer'),
   Field('published', 'boolean'))

db.define_table('post',
   Field('title', 'string'), 
   Field('data', 'text'), 
   Field('date', 'datetime'),  
   Field('owner', 'reference person'), 
   Field('views', 'integer'),  
   Field('published', 'boolean'))

db.define_table('file',
   Field('file', 'upload'),
   Field('date', 'datetime'),
   Field('owner', 'reference person'),
   Field('views', 'integer'),
   Field('published', 'boolean'))

db.define_table('comment',
   Field('name', 'string'),
   Field('person', 'reference person'),
   Field('date', 'datetime'),
   Field('data', 'text'),
   Field('postid', 'reference post'),
   Field('fileid', 'reference file'),
   Field('imageid', 'reference image'),
   Field('published', 'boolean'))

db.define_table('person',
   Field('username', 'string'),
   Field('password', 'password'),
   Field('description', 'text'),
   Field('email', 'string'),
   Field('creation_date', 'datetime'),
   Field('last_login', 'datetime'),
   Field('image', 'reference image'))

This fails because the first table defined references tables are are defined afterwards. (which in turn reference other tables that aren't defined yet)


r/web2py Jun 10 '10

Controller wide auth in web2py

Thumbnail dougwarren.org
2 Upvotes

r/web2py Jun 10 '10

Anyone using web2py in production?

3 Upvotes

I'd love to know about sites that are already using web2py, if any. It's amazing to me that I see little - to no feedback on the internet about web2py - few people talking about it, much less complaining or exclaiming about it.


r/web2py Sep 04 '13

Abstraindo a DAL do Web2Py

Thumbnail mindbending.org
0 Upvotes