[web2py] Re: Web2py + AngularJS: routes
I did not put a folder name such as your projects/. I kept the html paths flat. I converted the Angular Store sample to web2py + Angular: This worked for me: var storeApp = angular.module('AngularStore', ['ngRoute', 'angularTreeview']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/store', { templateUrl: 'store.htm', controller: storeController }). when('/products/:productSku', { templateUrl: 'product.htm', controller: storeController }). when('/cart', { templateUrl: 'shoppingCart.htm', controller: storeController }). otherwise({ redirectTo: '/store' }); }]); No need to specify index.html anywhere in the routing. I had a controller angularStore.py and so all the htmls (including index.html) are in folder: views/angularStore On Friday, August 15, 2014 11:59:29 AM UTC-5, Najtsirk wrote: OK, but how do I configure AngularJS routes? For example: App.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' }). when('/projects', { templateUrl: 'projects/index.html', controller: 'ProjektiCtrl' }) }]); How can I get routes to the partiapl templates right? Let's say that partial template for '/projects' is in views/projects/index.html directory. What is the right 'templateUrl' for this template? Best, Kristjan On Friday, 15 August 2014 02:58:51 UTC+2, dlypka wrote: in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Cannot register or login
Hi I encountered some very strange problems after I made some changes to my db tables. After having dropped all tables and removed all files under /myapp/databases, I cannot register or login. The register page constantly says please input your password again, whether I have submitted the registration form or not. Before that there was a flash that said logged out wherever I browsed. I tried to insert a basic record for email authorization with db.auth_user.validate_and_insert(password=mypass, email=m...@email.com), but when I try to login there is no flash and the login page just comes back with an empty form. I have not altered the default controller's user function or view. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py + AngularJS: routes
Cool. How did you manage to get authentication working? Did you do it on a separate, non Angular url, like 'default/user'? Did you manage to get it with Angular? Best, Kristjan On Saturday, 16 August 2014 15:28:52 UTC+2, dlypka wrote: I did not put a folder name such as your projects/. I kept the html paths flat. I converted the Angular Store sample to web2py + Angular: This worked for me: var storeApp = angular.module('AngularStore', ['ngRoute', 'angularTreeview']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/store', { templateUrl: 'store.htm', controller: storeController }). when('/products/:productSku', { templateUrl: 'product.htm', controller: storeController }). when('/cart', { templateUrl: 'shoppingCart.htm', controller: storeController }). otherwise({ redirectTo: '/store' }); }]); No need to specify index.html anywhere in the routing. I had a controller angularStore.py and so all the htmls (including index.html) are in folder: views/angularStore On Friday, August 15, 2014 11:59:29 AM UTC-5, Najtsirk wrote: OK, but how do I configure AngularJS routes? For example: App.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' }). when('/projects', { templateUrl: 'projects/index.html', controller: 'ProjektiCtrl' }) }]); How can I get routes to the partiapl templates right? Let's say that partial template for '/projects' is in views/projects/index.html directory. What is the right 'templateUrl' for this template? Best, Kristjan On Friday, 15 August 2014 02:58:51 UTC+2, dlypka wrote: in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: add static files to header from a module
I think I got it: - As Leonel said, Simply adding to current.response.files may not works if the request is ajax. I have to add: if a component is loaded with the LOAD function, adding to current.response.files will not work even if ajax=False and ajax_trap=False. - The statements: current.response.files.append(URL('static', 'jqplot/jquery.jqplot.min.js')) current.response.files.append(URL('static', 'jqplot/jquery.jqplot.min.css')) current.response.files.append(URL('static', 'jqplot/plugins/jqplot.barRenderer.min.js')) current.response.files.append(URL('static', 'jqplot/plugins/jqplot.categoryAxisRenderer.min.js')) current.response.files.append(URL('static', 'jqplot/plugins/jqplot.pointLabels.min.js')) must be placed in the __init__ method, or any other method that is called from the controller, not from the view (like the xml method). The combination of both issues confused me, so thanks for your help! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py + AngularJS: routes
I based my webapp on the web2py welcome app sample and I just use its login functionality. To get that to work with Angular, I copied layout.html to layout_angular.html and in layout_angular.html I changed all {{ }} to {[ ]} and I put that call response.delimiters = ('{[',']}') I showed you in the controller to change the web2py template delimiter to {[ ]}. In my opinion it is best to change the web2py delimiter, and leave angular as {{ }} because so many angular code snippets are being used and very little new web2py templates are needed in the angular version of web2py. Also in gluon/tools.py I tweaked the login code. I copied web2py_ajax.html to web2py_ajax_angular.html. I changed web2py_ajax_angular.html and index.html for all {{ }} to {[ ]} In layout_angular.html I made it use bootstrap 3. In index.html I changed it to use layout_angular.html and web2py_ajax_angular.html. After doing all that, then the regular web2py menu strip with the login drop down works. but =MENU messes up so remote the =MENU call from laytout_angular.html Instead, just below where =MENU was, put a standard Bootstrap 3 menu html fragment based on ul class=nav navbar-nav such as: ul class=nav navbar-nav li a href=/init/default/indexHome/a /li li a href=/init/about/about_usAbout US/a /li li a href=/init/about/helpHelp/a /li /ul In your style.css you can modify menu bar item colors by adding these css snippets; .navbar .nav li a { background-color: black; color:greenyellow; } /* set hover and focus */ .navbar .nav li a:focus, .navbar .nav li a:hover { background-color: gray; color: white; } /* set active item to darkgreen */ .navbar .nav .active a, .navbar .nav .active a:hover, .navbar .nav .active a:focus { background-color: lightgreen; color: black; } /* set font color and background of the project name (brand) */ .navbar .brand { background-color: orange; color: navy; } Good luck. On Saturday, August 16, 2014 9:29:32 AM UTC-5, Najtsirk wrote: Cool. How did you manage to get authentication working? Did you do it on a separate, non Angular url, like 'default/user'? Did you manage to get it with Angular? Best, Kristjan On Saturday, 16 August 2014 15:28:52 UTC+2, dlypka wrote: I did not put a folder name such as your projects/. I kept the html paths flat. I converted the Angular Store sample to web2py + Angular: This worked for me: var storeApp = angular.module('AngularStore', ['ngRoute', 'angularTreeview']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/store', { templateUrl: 'store.htm', controller: storeController }). when('/products/:productSku', { templateUrl: 'product.htm', controller: storeController }). when('/cart', { templateUrl: 'shoppingCart.htm', controller: storeController }). otherwise({ redirectTo: '/store' }); }]); No need to specify index.html anywhere in the routing. I had a controller angularStore.py and so all the htmls (including index.html) are in folder: views/angularStore On Friday, August 15, 2014 11:59:29 AM UTC-5, Najtsirk wrote: OK, but how do I configure AngularJS routes? For example: App.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' }). when('/projects', { templateUrl: 'projects/index.html', controller: 'ProjektiCtrl' }) }]); How can I get routes to the partiapl templates right? Let's say that partial template for '/projects' is in views/projects/index.html directory. What is the right 'templateUrl' for this template? Best, Kristjan On Friday, 15 August 2014 02:58:51 UTC+2, dlypka wrote: in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: scripts/cpdb.py is Python 2.7 only
I did not mean to criticize. Mart, if you are here, perhaps you can help us with this, check my changes and make sure it runs on python 2.5. On Thursday, 14 August 2014 22:10:16 UTC-5, Leonel Câmara wrote: Eheheh I commend your effort on this one Massimo, I wouldn't have touched it with a 10 foot pole. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to use user_bar() in Welcome app - custom login menu navbar
Not sure why, but the *welcome application *has a custom navbar in controller. userbar() I don't think it is used for anything... I want to use it to learn how customize navbar menu but - * How do I call this from the view? * Thanks, Rob /Contents/Resources/applications/examples/controllers/*default.py* def user_bar(): action = '/user' if auth.user: logout=A('logout', _href=action+'/logout') profile=A('profile', _href=action+'/profile') password=A('change password', _href=action+'/change_password') bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | ', logout, _class='auth_navbar') else: login=A('login', _href=action+'/login') register=A('register',_href=action+'/register') lost_password=A('lost password', _href=action+ '/request_reset_password') bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, _class ='auth_navbar') return bar /Contents/Resources/applications/welcome/views/*layout.html* ul id=navbar class=nav pull-right{{='auth' in globals() and auth.navbar(mode=dropdown) or ''}}/ul -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] why doesn't my custom registration form work?
Hi, I know there are many questions like this but I still couldn't find any solution to this. If there are any errors in the form they are reported correctly. However, when I do enter everything correctly the user is not added and there is no error message. I just return to the same page with the fields filled in again, as if something went wrong. This is a separate function from the normal default/user, and the normal default/user/register still works flawlessly. I have all the code in the view, and it looks like this: *{{form=auth.register()}}{{=form.custom.begin}} {{ form.custom.widget.email.update(_placeholder=y...@domain.com) input = DIV( form.custom.widget.email, _class=item-input ) =input form.custom.widget.password.update(_placeholder=password) input = DIV( form.custom.widget.password, _class=item-input ) =input form.custom.widget.password_two.update(_placeholder=password) input = DIV( form.custom.widget.password_two, _class=item-input ) =inputform.custom.submit.update(_class=button) input = DIV( form.custom.submit, _class=item-input )=input }}{{=form.custom.end}}* Thanks for your time and patience! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to use user_bar() in Welcome app - custom login menu navbar
You mention the welcome app, but the path you provided is in the examples app (which is the web2py.com website). Also, I cannot find a user_bar function in the default controller of the examples app (or the welcome app). Can you point to where that function is defined in the Github repo (https://github.com/web2py/web2py)? In any case, if you want to call a function from a view, it would either have to be defined in a model file, imported from a module, or returned by the controller in the dictionary. Anthony On Saturday, August 16, 2014 4:28:19 PM UTC-4, Rob_McC wrote: Not sure why, but the *welcome application *has a custom navbar in controller. userbar() I don't think it is used for anything... I want to use it to learn how customize navbar menu but - * How do I call this from the view? * Thanks, Rob /Contents/Resources/applications/examples/controllers/*default.py* def user_bar(): action = '/user' if auth.user: logout=A('logout', _href=action+'/logout') profile=A('profile', _href=action+'/profile') password=A('change password', _href=action+'/change_password') bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | ' , logout, _class='auth_navbar') else: login=A('login', _href=action+'/login') register=A('register',_href=action+'/register') lost_password=A('lost password', _href=action+ '/request_reset_password') bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, _class='auth_navbar') return bar /Contents/Resources/applications/welcome/views/*layout.html* ul id=navbar class=nav pull-right{{='auth' in globals() and auth.navbar(mode=dropdown) or ''}}/ul -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] scheduler timeouts on successful tasks
Hi, I've been using the scheduler quite successfully for a while now. But lately I've been getting TIMEOUTS on tasks that are successfully running to completion. I know this because: 1. I've added my own file mechanism to show that I made until the end, plus I can see that the results of the scheduled task are correct. 2. I've turned on logging and I can see: 2014-08-15 09:14:06,617 - web2py.scheduler.zebra.local#34260 - DEBUG - recording heartbeat (RUNNING) 2014-08-15 09:14:09,172 - web2py.scheduler.zebra.local#34231 - DEBUG - defining tables (migrate=True) 2014-08-15 09:14:09,631 - web2py.scheduler.zebra.local#34260 - DEBUG - recording heartbeat (RUNNING) 2014-08-15 09:14:12,151 - web2py.scheduler.zebra.local#34231 - DEBUG - defining tables (migrate=True) 2014-08-15 09:14:12,635 - web2py.scheduler.zebra.local#34260 - DEBUG - recording heartbeat (RUNNING) 2014-08-15 09:14:14,757 - web2py.scheduler.zebra.local#34260 - DEBUG - new task report: COMPLETED However as I monitor the database tables the task staying in RUNNING mode for the full five minutes until it then goes into TIMEOUT. This is driving me crazy. Is there some way I can debug this? I've tried various (stable) versions of web2py and am getting the same result. Thanks, Brad -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: search db, return table with pagination
Thanks Andriy! this is exactly what caused the problem. Is it also possible to make such request via ajax? e.g. when user submit a request, then instead of page reload and the check whether rows has something, the arguments from search box is passed via ajax and then the table is returned to the user? Thanks a lot in advance, Anna 2014-08-15 7:58 GMT+02:00 Andriy unhappyhardc...@gmail.com: Thats because your rows = None until you submit the form. You can add this check in the template: {{if rows:}} {{for i,row in enumerate(rows):}} ... ... a href={{=URL(args=[page+1])}}next/a {{pass}} {{pass}} Or you can try set rows to empty list in controller: def search(): rows = [] -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/MlcAgrMN3cM/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py Deployment Script for Ubuntu 14.04
I added Brian's changes, added SSL Rewrite to deal with the /admin page needing SSL, etc. You can run the updated code like this: wget https://raw.githubusercontent.com/ivandigiusto/web2py-install/master/setup-web2py-ubuntu-14.04.sh chmod +x setup-web2py-ubuntu-14.04.sh sudo ./setup-web2py-ubuntu-14.04.sh I will be submitting a proposed solution on code.google site. Ivan On Saturday, 19 July 2014 14:51:44 UTC+10, Brian M wrote: I posted about this a couple weeks ago along with what worked for me ,, https://groups.google.com/forum/#!searchin/web2py/Apache$20Ubuntu%7Csort:date/web2py/o6OGQRQTN6Y/oJJQMGChgpcJ On Friday, July 18, 2014 7:14:18 AM UTC-5, Auden RovelleQuartz wrote: This recipe which had worked: { One step production deployment Here are some steps to install apache+python+mod_wsgi+web2py+postgresql from scratch. On Ubuntu: wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh chmod +x setup-web2py-ubuntu.sh sudo ./setup-web2py-ubuntu.sh } *no longer works when using the Ubuntu 14.04 operating system.* Instead of getting the default web2py welcome application (when you type in the IP address on the browser), an Apache default page is displayed. returning to Ubuntu 12.04 operating system fixed the issue (the deployement recipe worked on that older Ubuntu version) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Using cache for improving pagination recipe in the manual?
I have read the manual recipe on pagination: http://web2py.com/books/default/chapter/29/14/other-recipes#Pagination That works fine if we just want to have a page aware if it has a previous or next one, but what if we want also to get the list of all next pages? i.e. by putting a link for each next page, near the next button? Let's say I have 300 records in a table, I want to serve 10 per time. If I am serving page 1, there are other 29 pages more, so I want to be able to put links at least to page 2, 3, 4, 5, 6 so to make navigation easier. The recipe in the manual is quite good, because it allows to get only the 10 elements I need to serve in the current page, but my page do not know how many pages there are in total. I was thinking to solve this creating a PageThread class taking care of storing the information about the whole. My idea was to let this class making the query for all items in the table and then creating the single pages to serve. But the problem here is that when the controller will instantiate this class it will reset it all times, so it will make the query to the whole table every time, so it's wasted. Probably this can be solved using the web2py built-in count() or is there a possibility to use cache? Does anybody already solved this problem somewhere? This is a sample of the code of the two classes I thought about: class PageThread(object): def __init__(self, items, items_per_page=10): self.items = items self.items_count = len(self.items) self.items_per_page = items_per_page self.__set_number_of_pages() self.__load_pages() def __set_number_of_pages(self): self.number_of_pages = self.items_count/self.items_per_page + 1 if self.items_count % self.items_per_page else self.items_count/self. items_per_page def __load_pages(self): self.pages = [Page(p_id, self.items[(p_id-1)*self.items_per_page: p_id*self.items_per_page]) for p_id in range(1, self.number_of_pages+1)] class Page(object): def __init__(self, id, items): # id is the unique number of the page in the PageThread self.id = id self.items = items def __str__(self): return 'Page n.{}, {} items: {}'.format(self.id, len(self.items), self.items) While this was the original Page that just knows if it has previous or next: class Page(object): def __init__(self, page, items_per_page=10): self.id = int(page) self.items_per_page = items_per_page # range gives you an item more in order to check if there is a next page self.range = ((self.id-1)*self.items_per_page, self.id*self. items_per_page+1) def load_items(self, rows): # where rows are those returned from a select query to the db if len(rows) self.items_per_page : self.has_next = True self.items = rows[:-1] else: self.has_next = False self.items = rows def get_page_navigation_div(self, **request_vars): contents = [] request_vars.update({'items_per_page': self.n_items}) if self.has_previous: request_vars.update({'page': self.id-1}) contents.append( A(' previous', _class='nav-previous', _href= URL(vars=request_vars)) ) for n in range(1, self.id): request_vars.update({'page': n}) contents.append( A(' %s' % n, _class='nav-page', _href=URL(vars= request_vars)) ) if self.has_next: request_vars.update({'page': self.id+1}) contents.append( A('next ', _class='nav-next', _href=URL(vars =request_vars)) ) return DIV(*contents, _id='page_navigation') In the controller you use like this: page = Page(request.vars.page, 10) page.load_items(db(your_query).select(limitby=page.range)) #do stuff return dict(page=page) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] one-to-many relations and form for crerate records
Hello. This is just a simple example, my actual model is more complex, but I think I can explain the main idea. Model: db.define_table('users', Field('name', 'string')) db.define_table('contacts', Field('user', db.users), Field('phone', 'string')) Well, each user can have from 1 to infinite phone numbers. I want user entering all his numbers while registering. So, what are the ways to realize it? 1) Split registration process to steps, step one - enter name, step two - add phones one by one. Ugly. 2) Use smartgrid. Have parent-children out of the box. Being, may be, cool tool for admin purposes, it is absolutely unintuitive and unusable for end-users. 3) Make custom form with jquery: form have button add another phone number, user press the button and another text field adding dynamicaly for the infinite form. Excellent way. But. This is theoretically. And I cant find any practical examples. So, testing I can see that inputs with same name processing by web2py as a list, its fine! For example, there is a duplicated inputs in the form: input name=phone type=text input name=phone type=text after submitting, I have ['123456','345678'] on form.vars.phone. Cool. Cycle and do db.insert() voila, you say! No. Linked table contacts actually is more more complex. It have address string, state string, postal, validators and another linked tables such postals, cities, etc, etc... And I have no idea how build my form and how to process my form vars within controller with all contact table validators? Is there any elegant way doing this? Found this: http://www.web2pyslices.com/slice/show/1427/single-form-for-linked-tables not so helpful. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: web2py shell vs terminal shell
OK, how do I open a ticket? On Wed, Aug 13, 2014 at 8:04 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please open a ticket about this. This is a major issue. Perhaps we should remove the web based shell. On Wednesday, 13 August 2014 02:41:17 UTC-5, Giacomo Dorigo wrote: Today I discovered an other problem with the admin shell. If I execute command 1 and then command 2, at this point it will re-execute command 1 too. If then I execute command 3, it will execute again also 1 and 2. This is while running web2py from source code on Windows with simple python web2py.py On Saturday, April 6, 2013 6:09:40 AM UTC+2, Massimo Di Pierro wrote: The admin shell has problems maintaining state. I do not consider it reliable. The terminal shell is rock solid. It is a normal pyhton shell. On Friday, 5 April 2013 16:48:50 UTC-5, Michael Herman wrote: yes. so when working with DAL directly from the shell it's better to work from the web2py shell in the terminal rather than the admin app shell? any idea why? On Fri, Apr 5, 2013 at 2:43 PM, Anthony abas...@gmail.com wrote: By built-in shell, do you mean the one in the admin app? I think there are sometimes problems with that (particularly with database operations), so I tend to use the web2py shell in the terminal, which you can start as follows from the web2py directory: python web2py.py -S yourapp/[optional controller] -M But you may fine the admin shell works just fine for you, in which case, use it. Anthony On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote: i remember reading somewhere that it's better to use the built-in shell in web2py, but i can't find the article/post. anyone know (1) if it is better, and, (2) if so, why? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/web2py/XWMt1Pb_2wk/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/XWMt1Pb_2wk/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: why doesn't my custom registration form work?
First of all I really like the way you are building your form. :-) The problem is that the auth_user table also has a required first_name and last_name. because these fields do not appear in the form, web2py has no way to report the error. Try add this {{=form.errors}} So make the fields not required {{ db.auth_user.first_name.requires = db.auth_user.last_name.requires = [] }} On Saturday, 16 August 2014 18:05:16 UTC-5, Robin Manoli wrote: Hi, I know there are many questions like this but I still couldn't find any solution to this. If there are any errors in the form they are reported correctly. However, when I do enter everything correctly the user is not added and there is no error message. I just return to the same page with the fields filled in again, as if something went wrong. This is a separate function from the normal default/user, and the normal default/user/register still works flawlessly. I have all the code in the view, and it looks like this: *{{form=auth.register()}}{{=form.custom.begin}} {{ form.custom.widget.email.update(_placeholder=y...@domain.com y...@domain.com)input = DIV( form.custom.widget.email, _class=item-input )=input form.custom.widget.password.update(_placeholder=password) input = DIV( form.custom.widget.password, _class=item-input ) =input form.custom.widget.password_two.update(_placeholder=password) input = DIV( form.custom.widget.password_two, _class=item-input ) =inputform.custom.submit.update(_class=button) input = DIV( form.custom.submit, _class=item-input )=input }}{{=form.custom.end}}* Thanks for your time and patience! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to use user_bar() in Welcome app - custom login menu navbar
would advice against customizing the auth.navbar(). It is just a convenience function. It is easier and cleaner to just code a nabvar in html. On Saturday, 16 August 2014 15:28:19 UTC-5, Rob_McC wrote: Not sure why, but the *welcome application *has a custom navbar in controller. userbar() I don't think it is used for anything... I want to use it to learn how customize navbar menu but - * How do I call this from the view? * Thanks, Rob /Contents/Resources/applications/examples/controllers/*default.py* def user_bar(): action = '/user' if auth.user: logout=A('logout', _href=action+'/logout') profile=A('profile', _href=action+'/profile') password=A('change password', _href=action+'/change_password') bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | ' , logout, _class='auth_navbar') else: login=A('login', _href=action+'/login') register=A('register',_href=action+'/register') lost_password=A('lost password', _href=action+ '/request_reset_password') bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, _class='auth_navbar') return bar /Contents/Resources/applications/welcome/views/*layout.html* ul id=navbar class=nav pull-right{{='auth' in globals() and auth.navbar(mode=dropdown) or ''}}/ul -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: web2py shell vs terminal shell
https://code.google.com/p/web2py/issues/entry On Saturday, 16 August 2014 23:08:36 UTC-5, Giacomo Dorigo wrote: OK, how do I open a ticket? On Wed, Aug 13, 2014 at 8:04 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please open a ticket about this. This is a major issue. Perhaps we should remove the web based shell. On Wednesday, 13 August 2014 02:41:17 UTC-5, Giacomo Dorigo wrote: Today I discovered an other problem with the admin shell. If I execute command 1 and then command 2, at this point it will re-execute command 1 too. If then I execute command 3, it will execute again also 1 and 2. This is while running web2py from source code on Windows with simple python web2py.py On Saturday, April 6, 2013 6:09:40 AM UTC+2, Massimo Di Pierro wrote: The admin shell has problems maintaining state. I do not consider it reliable. The terminal shell is rock solid. It is a normal pyhton shell. On Friday, 5 April 2013 16:48:50 UTC-5, Michael Herman wrote: yes. so when working with DAL directly from the shell it's better to work from the web2py shell in the terminal rather than the admin app shell? any idea why? On Fri, Apr 5, 2013 at 2:43 PM, Anthony abas...@gmail.com wrote: By built-in shell, do you mean the one in the admin app? I think there are sometimes problems with that (particularly with database operations), so I tend to use the web2py shell in the terminal, which you can start as follows from the web2py directory: python web2py.py -S yourapp/[optional controller] -M But you may fine the admin shell works just fine for you, in which case, use it. Anthony On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote: i remember reading somewhere that it's better to use the built-in shell in web2py, but i can't find the article/post. anyone know (1) if it is better, and, (2) if so, why? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/web2py/XWMt1Pb_2wk/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/XWMt1Pb_2wk/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] email not sent
on PythonAnywhere, I get email not sent error did I do anything wrong? ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'a...@gmail.com' # your email 2014-08-17 04:51:36,559 :email not sent From: a...@gmail.com To: a...@gmail.com Subject: Password reset Click on the link https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password/140 to reset your password 2014-08-17 04:48:48 announcing my loyalty to the Emperor... 2014-08-17 04:51:36 WARNING:web2py:email not sent#012#012From: alex...@gmail.com#012To: a...@gmail.com#012Subject: Password reset#012#012Click on the link https://alexglaros.pythonanywhere.com/engagementSquared/default/user/reset_password9ce8cd5 to reset your password#012 thanks, Alex Glaros -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.