On Monday, March 5, 2018 at 4:19:49 AM UTC-8, Esprit Garonne wrote: > > Hi > I have last version of web2py, I dont understand why all buttons don't > showing.I have only text link. > > In my school project for city of Tours, I try to build this form with > web2py, > https://www.blablacar.fr/offer-seats/1 > About "Etapes" to add city,I need really some advice,? Can I build it > with SQLFORM.factory? or JQUERY? > I know, web2py is really powerfull, It is very hard to understand all > concept in web2py >
If you want that page to be composed of (or constructed from) several smaller forms, then I would use the component technique (and the LOAD() feature that wraps ajax requests), rather than starting out with JQuery directly. <URL:http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components--LOAD-and-Ajax> Your view would start with something like this: {{extend 'layout.html'}} <h1>Current Known Steps</h1> <span id="jsoffs">Javascript off? <a href="steps-nojs.html" id="jsoffa">Click here</a></span> <br> {{loadmsg = CAT("loading ...", BR(), SPAN(_class="fa fa-spinner fa-spin"))}} {{=LOAD(c='default', f='steps.load', target='my_steps', content=loadmsg, ajax=True)}} <script type="text/javascript"> $(document).ready(function (){ document.getElementById("jsoffs").style.visibility="hidden" ; } ) </script> (The stepsnojs.html target is for those people who disable javascript, and would be a page that just does a bare HTML FORM element.) The LOAD() call specifies the controller (default.py), the function (steps()), and the DIV where it will be loaded (my_steps). Note that I specified "steps.load", which says to use a partial view template when rendering the results into the DIV. You can also have steps.html, if you also want the individual form to load as a stand-alone page. > Do I need to use list:string ? > > I gather your project is planning a trip that will consist of several steps or stages (étapes). I think I would not use a list:string for the steps. I think you're on the right track to use a table of steps with each row in the table a single step, and then use parent links to attach the steps to the itinerary. Does my model in web2py is ok? > Fair warning: I'm not as skilled as spotting model issues as some of the more experienced contributors (some of our posters are very skilled with databases), so I may miss some issues and may make less-than-perfect suggestions. > > FREQUENCES=('Quotidien','Exceptionnel','Weekend','Samedi','Dimanche') > TYPE_TRAJETS=('Aller','Retour','Aller-Retour') > FUMEUR=('Oui','Non','Indifférent') > db.define_table( > 't_trajets', > Field('membre_voiture_id','reference t_voitures'), > Field('lieu_depart_id','reference t_villes'), > Field('lieu_arrive_id',db.t_villes), > Field('depart_le','datetime'), > > Field('frequence',requires=IS_IN_SET(FREQUENCES),default=FREQUENCES[0]), > > Field('type',requires=IS_IN_SET(TYPE_TRAJETS),default=TYPE_TRAJETS[0]), > > Field('fumeur',requires=IS_IN_SET(FUMEUR),default=FUMEUR[1]), > Field('commentaire','text'), > Field('prix','integer'), > Field( 'place_offert','integer'), > auth.signature > ) > db.define_table('t_etapes_ville', > Field('trajet_id','reference t_trajets'), > Field('ville_id','reference t_villes'), > Field('ordre_depart','integer'), > > ) > I would make the steps reference both the start and finish locations (departure, arrival aka partez-vous, allez-vous). I don't need that in one of my databases, but then I'm not doing an itinerary, just a log of where I've been. <URL:https://groups.google.com/d/topic/web2py/BRKwDC7PYFs/discussion> (First post is the model information, and the end of the thread (discussion) shows how Anthony helped me fix my function.) > db.define_table('t_villes', > Field('dep', type='string', notnull=True, > label=T('Département')), > Field('nom', type='string', notnull=True, > label=T('ville')), > Field('code_postal', type='string', notnull=True, > label=T('Code postal')), > Field('longitude_deg', type='float', notnull=True, > label=T('Longitude')), > Field('latitude_deg', type='float', notnull=True, > label=T('Latitude')), > format='%(nom)s %(code_postal)s' > ) > Many Thx > > Good luck! Dave S /dps -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

