[web2py] SQLFORM.grid and query
I have a problem using SQLFORM.grid and a query from a FORM: Here is my controller def synthese(): ListeFamille=db(db.ATPOSTE.id0).select(orderby=db.ATPOSTE.PS_FAMI) selection=FORM(TABLE(TR( TD('Début',INPUT(_name='Deb',id=1,_class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD('Fin',INPUT(_name='Fin',id=2,_class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD('Famille',SELECT('Frappe','Reprise','Tri',_name='Famille')), TD(INPUT(_type='submit',_value='Sélectionner')) ))) Deb=request.vars.Deb Fin=request.vars.Fin Famille=request.vars.Famille if Deb: query1=db.Rebuts.Date=Deb else: query1=db.Rebuts.id0 if Fin: query2=db.Rebuts.Date=Fin else: query2=db.Rebuts.id0 query3=db.Rebuts.Famille==Famille if Famille=='Tri' : query3=(db.Rebuts.Machine=='TRI')(db.Rebuts.Famille=='NQ') if Famille=='Reprise' : query3=(db.Rebuts.Famille!='NQ')(db.Rebuts.Famille!='Frappe') query=query1query2query3 records=db(query).select() if selection.accepts(request.vars,keepvalues=True): pass form=SQLFORM.grid(query=query,user_signature=False,searchable=True,paginate=True) And the return dict (form=form) The query works well and the grid also when I fill Selection and validate. Yet when I paginate, sort or query inside teh grid I lost every my grid data (empty grid). Does somebody knows what's wrong with my controller ? Thanks a lot to web2py fantastic community JmiXIII
Re: [web2py] Re: SQLFORM.grid and query
I agree with Jim S. The grid is completely blank because it has lost the data. Just discover it; I think a nice way would be to use smartgrid: form=SQLFORM.smartgrid(db.Rebuts, details=False, csv=False, search_widget=selection, searchable=None, paginate=15, maxtextlength=45) I need to perform some logic after the submission, so I guess i Have to go through selection.validate I have never use it so I'm a bit reluctant, but I think this is athe best way for my case
Re: [web2py] Re: SQLFORM.grid and query
Thank you for your support. I'm working on my side to adapt my controller, but I'm not so good to provide a general solution. JmiXIII
[web2py] Re: SQLFORM.grid and query
Hello, Sorry for the delay. The accepts is just here to process the Selection form check of field (date,...). Might it be because I hace 2 forms in my page (FORM and SQLFORM) ? for the sum it has been transformed to : if selection.accepts(request.vars,keepvalues=True): pass form=SQLFORM.grid(query) ###Paretto des couts### articles=db(query).select(db.Rebuts.Article, distinct=True) sumtest=db.Rebuts.CtReb.sum() summary=db(query).select(sumtest).first()[sumtest] liste=[]
[web2py] sqlform.grid
Hello, I have something like: selection=FORM(TABLE(TR( TD('Début',INPUT(_name='Deb'),_class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !'))), TD('Fin',INPUT(_name='Fin',_class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD('Famille',SELECT('Frappe','Reprise','Tri',_name='Famille')), TD(INPUT(_type='submit',_value='Sélectionner')) ))) Deb=request.vars.Deb Fin=request.vars.Fin Famille=request.vars.Famille Ct=0 query1=db.Rebuts.Date=Deb query2=db.Rebuts.Date=Fin query3=db.Rebuts.Famille==Famille if Famille=='Tri' : query3=(db.Rebuts.Machine=='TRI')(db.Rebuts.Famille=='NQ') if Famille=='Reprise' : query3=(db.Rebuts.Famille!='NQ')(db.Rebuts.Famille!='Frappe') query=query1query2query3 records=db(query).select() for record in records: Ct=Ct+record.CtReb if selection.accepts(request.vars,keepvalues=True): pass form=SQLFORM.grid(query) return dict(selection=selection,Ct=Ct,form=form Everything is all right except, I can't paginate with sqlform.grid (selection form data seems to be lost). Can somebody give a way to solve it ? Thanks in advance
[web2py] Re: sqlform.grid
Sorry I open a new discussion
[web2py] SQLFORM.grid and query
Hello, I have something like: selection=FORM(TABLE(TR( TD('Début',INPUT(_name='Deb'), _class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !'))), TD('Fin',INPUT(_name='Fin',_class=date, requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD('Famille',SELECT('Frappe','Reprise','Tri',_name='Famille')), TD(INPUT(_type='submit',_value='Sélectionner')) ))) Deb=request.vars.Deb Fin=request.vars.Fin Famille=request.vars.Famille Ct=0 query1=db.Rebuts.Date=Deb query2=db.Rebuts.Date=Fin query3=db.Rebuts.Famille==Famille if Famille=='Tri' : query3=(db.Rebuts.Machine=='TRI')(db.Rebuts.Famille=='NQ') if Famille=='Reprise' : query3=(db.Rebuts.Famille!='NQ')(db.Rebuts.Famille!='Frappe') query=query1query2query3 records=db(query).select() for record in records: Ct=Ct+record.CtReb if selection.accepts(request.vars,keepvalues=True): pass form=SQLFORM.grid(query) return dict(selection=selection,Ct=Ct,form=form Everything is all right except, I can't paginate with sqlform.grid (selection form data seems to be lost). Can somebody give a way to solve it ? Thanks in advance
Re: [web2py] Re: new web site
Looks great, Nevertheless http://web2py.com/new_examples/default/what After The best way = too much to read and to compact, a more visual,structured presentation would be easier to read
[web2py] Windows7 python2.7 SQLite web2py
Hello, I'm facing a pb with windows 7/SQLite (current)/python2.7 I'm working on local and just lunch web2py.py with python2.7 nearly 50% of my request have the folloowing issue : Traceback (most recent call last): File C:\Users\user11\Desktop\web2py\gluon\restricted.py, line 194, in restricted exec ccode in environment File C:/Users/user11/Desktop/web2py/applications/xxx/models/db.py http://192.168.1.102/admin/default/edit/SAMAT/models/db.py, line 102, in module Field(GA_NUMG,integer) File C:\Users\user11\Desktop\web2py\gluon\dal.py, line 4491, in define_table polymodel=polymodel) File C:\Users\user11\Desktop\web2py\gluon\dal.py, line 700, in create_table fake_migrate=fake_migrate) File C:\Users\user11\Desktop\web2py\gluon\dal.py, line 801, in migrate_table tfile = self.file_open(table._dbt, 'w') File C:\Users\user11\Desktop\web2py\gluon\dal.py, line 496, in file_open fileobj = open(filename,mode) IOError: [Errno 13] Permission denied: 'C:\\Users\\user11\\Desktop\\web2py\\applications\\xxx\\databases\\7220618fff53ed2e8edbb0fe66a230f8_ATGAMME.table' I restarted an appp from scratch from the above config. If I refresh the browser (Last FF)often I can acces once again the result. I checcked with IE8 = same pb Everything is all right I looked in my PC to give all rights in the web2py folder, but i doesn't work either. Does anybody faced the pb ? Any idea to solve this ? Best regards
[web2py] Re: Windows7 python2.7 SQLite web2py
Yep I have my own python installation and are running from source Not I do not have pywin32 installed But I do not remember to have it installed on my previous computer. Anyway I'll try it thanks
[web2py] Re: Windows7 python2.7 SQLite web2py
Hello, I have installed pywin32 ofr python27 Seems to work a little better but if I stress my computer on a web page (form for example), I still have the pb. JmiXIII
[web2py] Re: Windows7 python2.7 SQLite web2py
Hello, I confirm that pywin32 doesn't help in this issue. I've searched on the web but did not find any peaple facing this pb with sqlite and windows7. Yet I nearly bet that if i use win xp evferything is all right and i cannot figure nobody has already faced this pb ... sic JmiXIII
[web2py] Re: Windows7 python2.7 SQLite web2py
May I send someone my app to check on a windows7 + python2.7 + sqlite to check if this is an os/computer pb or linked to my app/database ? What i cannot understand is why after 2 or more attemps it suddenly works it really seems a randomly pb
Re: [web2py] Re: Confused about hidden fields
Hello, For hidden field I usually used p style=display : None{{=form.custom.widget}}/p But you can still access the value from code so it depends your needs. JmiXIII
[web2py] Re: Windows7 python2.7 SQLite web2py
Ok willoughby = seems you are right =good to see it working good again Thanks to the whole web2py community
[web2py] Re: table, grid, smartgrid, getting better
+1 so do I
[web2py] Re: table, grid, smartgrid, getting better
+1 Powertable intant search for each column is really powerfull
Re : Re: [web2py] Re: fluxflex
As far as I understand : get_new_stable is a git branch of the git web2py-for-fluxflex which allow to import the last stable vesrion of web2py. Yet if you do so you will lost your previously installed app. I think you should prefer the builtin upgrade button of the admin web2py, but I haven't tried since my project are already running the last stable version. I've always used upgrade builtin button and it always worked on localhost.
Re : Re: [web2py] Re: fluxflex
Hello Seems fantastic, yet I cannot access the admin page 1- create a project projecttest 2- Setup = github import 3- Url : https://github.com/nus/web2py-for-fluxflex.git 4- Branche : get_new_stable 5- Run intialize script and import ... import starded project avaliable Web2py welcome page Ok Then I check for my database password here : https://www.fluxflex.com/projects/projecttest/instruction/database (notice phpmyadmin is working) Return in the web2py welcomeapp and try admin page : http://projecttest.fluxflex.com/admin But it says that admin is unvailable because it cannot find the password's file Does I made something wrong ?
Re : Re: [web2py] Re: table, grid, smartgrid, getting better
Nice Look, I would appreciate sortable function and why not column specific search as you have in PowerTable but I think it might be a bit heavy for minimalist app.
Re : Re: Re : Re: [web2py] Re: fluxflex
Good thanks a lot. I thought I've tried it but my browser confused me with (I must have made a mistake) Anyway thanks to you and to this community.
[web2py] Re : Re: fluxflex
Hello, Does'nt it work with the upgrade button of the admin page ?
Re : Re: [web2py] web2py on fluxflex (free hosting) VIDEO/HOWTO
great thanks
[web2py] web2py.com/poweredby / Quality Systems
Hello, I was just having a look at web2py.com/poweredby and in particular Quality Systems Tool: http://www.qualitysystems.com It seems to me this tool is made with Plone instead of web2py did I miss something ?
[web2py] Re : Re: web2py.com/poweredby / Quality Systems
In fact I'm speaking about this http://www.qualitysystems.com/qs/toolbox/index.html, the tool they promote, not directly the frontend of the site (I agree with the code source) You can see that the tool they sell looks really really really like the CMS Plone2.xxx. I'm pretty sure that if someone has used Plone2.x he will recognize it and every kind of skin , button,user interface,edit action, sort , is copied from Plone. That's why I believe the tool has been made with Plone. I would be interesting to have Plone user opinion.
[web2py] Re : Re: web2py.com/poweredby / Quality Systems
Here are some links that show plone2.5 in action http://plone.org/documentation/manual/plone-2.5-user-manual/introduction/visual-design-of-plone-web-sites http://plone.org/documentation/manual/plone-2.5-user-manual/managing-content/editing-content http://plone.org/documentation/manual/plone-2.5-user-manual/managing-content/folder-view http://plone.org/documentation/manual/plone-2.5-user-manual/referencemanual-all-pages The live search is another indication, they really both look the same I just mentionned it because even if the frontend of qualitysystems.com is made with web2py, I have a big doubt with the tool they sell. So I find it confusing to present it powered by Web2py, found worth to mention it
[web2py] Re : Edit record vs View record
You should maybe use CRUD : http://web2py.com/book/default/chapter/07?search=crud#CRUD crud.read(db.tablename, id) returns a readonly form for tablename and record id.
Re : Re: [web2py] Re: Web2py Powertables plugin : in-line editing problem.
Hello , PowerGrid seems pretty nice and usefull, yet powertable fits better my needs. I've used the details to render other view containing forms and it's Ok for me. Yet is Powergrid intended to replace PowerTable or will you work on both project? That's just to know which plugin to choose for my work. I do understand it's a hard job to maintain it and thank you for the job you share.
[web2py] Re: LAMP like frameworks are dying. Time for the javascript age
Expect the growth of more full-blown desktop-like apps hosted in the browser (like the Ext JS desktop demo). Expect people to begin to hate refreshing the page. = +1 I really agree with this and I wish so much webbrowser could use python as javascript On 12 avr, 00:46, cjrh caleb.hatti...@gmail.com wrote: On Apr 9, 10:35 am, Luther Goh Lu Feng elf...@yahoo.com wrote: I hope to learn from everyone's opinion on this. It is pretty clear that the future belongs to javascript, as long as that is the language that all browsers support. Expect javascript JITs to improve. Expect the growth of more full-blown desktop-like apps hosted in the browser (like the Ext JS desktop demo). Expect people to begin to hate refreshing the page. By including jQuery, web2py is ahead of the curve, or at least on par with the other traditional frameworks. We could probably make AJAX even easier if we tried. We probably should try. More support for reducing page refreshes.
[web2py] Re: tabular form
I'll give it a try thanks On 16 mar, 02:46, DenesL denes1...@yahoo.ca wrote: Something like this: def names30(): import copy n=db.person.name ff=[] for i in range(0,30): nn=copy.copy(n) nn.name='%s%02i' %(nn.name,i) ff.append(nn) form=SQLFORM.factory(*ff) if form.accepts(request.vars, session, dbio=False): for v in form.vars.values(): if v: # db insert goes here db.person.insert(name=v) elif form.errors: response.flash='oops' return dict(form=form) On Mar 15, 7:26 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello, I need to key around 30 value for a single field at regular times. Using a loop form in a view doesn't fit this purpose as I will have to submit every form. I'd prefer a kind a tabular and a single submit button that would save the 30 values in the database. Can somebody give me a clue on the way to achive this ?
[web2py] tabular form
Hello, I need to key around 30 value for a single field at regular times. Using a loop form in a view doesn't fit this purpose as I will have to submit every form. I'd prefer a kind a tabular and a single submit button that would save the 30 values in the database. Can somebody give me a clue on the way to achive this ?
[web2py] Re: What's the best way to backup/restore a web2py app
I would use the pack tool in appadmin, it works well and pack the database and the app in a single file. By the way the database is included in the app so if you compress the whole database you will have the database included in the compressed file. On 13 mar, 23:57, VP vtp2...@gmail.com wrote: What I have done so far is compress the entire app folder and backup the database separately. I don't think this is the best way, or is it? Thanks.
[web2py] Re: What's the best way to backup/restore a web2py app
Sorry I only use SQLite for my needs I did not try with other server based database On 14 mar, 16:53, VP vtp2...@gmail.com wrote: My understanding is that the database is stored in the web2py app folder only if you use SQLite (storage.sql). I think web2py keeps information about the models in app/database, but if you use Postgres, MySQL, etc., they keep their own copy of the database somewhere else. Or does web2py instruct Postgres to store the particular database in its own app directory? It would be nice that way. On Mar 14, 9:20 am, JmiXIII sylvn.p...@gmail.com wrote: I would use the pack tool in appadmin, it works well and pack the database and the app in a single file. By the way the database is included in the app so if you compress the whole database you will have the database included in the compressed file. On 13 mar, 23:57, VP vtp2...@gmail.com wrote: What I have done so far is compress the entire app folder and backup the database separately. I don't think this is the best way, or is it? Thanks.
[web2py] Re: should this be in the scaffolding app?
+1 -- On 28 fév, 21:45, Lucas D'Avila lucass...@gmail.com wrote: +1 -- Lucas D'Avilahttp://flavors.me/lucasdavila Sent from my phone Em 28/02/2011 17:26, Anthony abasta...@gmail.com escreveu: +1
[web2py] Re: SQLFORM factory field name problem
I'm facing the pb I suppose : Here is my models : db.define_table(Poste, Field(Poste, string, notnull=False, default=None)) db.define_table(Article, Field(CodeArticle,string, notnull=True, default=None), Field(Designation,string, notnull=True, default=None)) db.define_table(GPGACLAR, Field(CP_CLAR,string), Field(CP_CART,string)) db.define_table(OF, Field(META_OF, integer,requires=IS_NOT_EMPTY()), Field(META_RespOF,string), Field(META_Affectation, string), Field(META_Debut, datetime), Field(META_Fin, datetime), Field(META_QTransfert, integer), Field(META_Rques, text)) db.define_table(GPOF, Field(OF_CODE, integer,notnull=False, default=None), Field(OF_CART, string,notnull=False, default=None), Field(OF_QUAN, double,notnull=False, default=None)) db.define_table(LigneOF, Field(OF, integer), Field(Date,date, default=None), Field(Equipe,integer, requires=IS_IN_SET(['1','2','3'])), Field(Cdebut,integer, requires=IS_LENGTH(6)), Field(Cfin,integer, requires=IS_LENGTH(6)), Field(Qrebuts,integer, requires=IS_NOT_EMPTY()), Field(Rques,text)) db.OF.META_Affectation.requires=IS_IN_DB(db, 'Poste.Poste') db.LigneOF.OF.requires=IS_IN_DB(db, 'GPOF.OF_CODE') db.define_table(ATGAMME, Field(GA_OUTI,string), Field(GA_CART,string), Field(GA_TSAI,double)) db.define_table(NC, Field(NC_Id, integer), Field(NC_DOuverture, date, default=now), Field(NC_Num,string), Field(NC_Type, requires=IS_IN_SET([Interne,Client,Fournisseur])), Field(NC_Commande,string), Field(NC_Client,string), Field(NC_Rapport_Client,upload, autodelete=True), Field('NC_Rapport_Client_filename'), Field(NC_Four,string), Field(NC_Identifiant,string), Field(NC_Lot,string), Field(NC_Descripif,text), Field(NC_PotNC,string), Field(NC_QteeNC,string), Field(NC_DCloture,date), Field(NC_Image,string), Field(NC_Causes,text), Field(NC_Solutions,text), Field(NC_Moule,string), Field(NC_Derog,boolean), Field(NC_Rebuts,boolean), Field(NC_Rep,boolean), Field(NC_Reprise,text), Field(NC_Decideur,string), Field(NC_DesCout,text), Field(NC_Cout,integer)) db.define_table(AC, Field(AC_NC,integer,default=None), Field(AC_Descriptif,text), Field(AC_Pilote,string), Field(AC_type,requires=IS_IN_SET([Curative,Corrective,Préventive])), Field(AC_Delai,date), Field(AC_Realise,boolean), Field(AC_Verif,text), Field(AC_DVerif,date), Field(Ac_Cloturee,boolean), ) On 1.91.6 = SQLform submit Ok On 1.92 = I can't submit my SQLForm is it related ti teh pb rãma pointed ? I downgraded to 1.91.6 and it works fin now ... On 28 fév, 23:11, rāma ranjeev...@gmail.com wrote: SQLFORM factory field name with underscore doesn't submit properly in the below case: SQLFORM.factory(Field('fieldname', - Submit OK SQLFORM.factory(Field('select_fieldname', - Submit failed got a None returned I think. just to add: form catches the session as well. Regards, Rama
[web2py] Re: SQLFORM factory field name problem
Does not work on 1.92.1 but works with trunk. Thanks On 1 mar, 15:56, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I am using trunk and I cannot reproduce this problem. On Feb 28, 4:11 pm, rāma ranjeev...@gmail.com wrote: SQLFORM factory field name with underscore doesn't submit properly in the below case: SQLFORM.factory(Field('fieldname', - Submit OK SQLFORM.factory(Field('select_fieldname', - Submit failed got a None returned I think. just to add: form catches the session as well. Regards, Rama
[web2py] Re: Date intervals split
Understood, and I suppose i have to pass a date type through my form (not an SQLFORM) according to html5 (_type=date) so that form.vars guess it is a date type. On 22 fév, 01:41, Brian M bmere...@gmail.com wrote: You may want to look at the python-dateutil module fromhttp://niemeyer.net/python-dateutilit makes it easy to do date manipulation like adding/subtracting days, weeks, months, etc. The _class part just makes a handy datepicker widget appear in the UI. The important part is to use form.vars instead of request.vars because then you'll get a date object like date(2011,2,21) instead of a string '2011-02-21' and can therefore do easy date manipulation and use it with the DAL.
[web2py] Re: Date intervals split
Ok works fine thanks to your help ! On 22 fév, 15:27, Brian M bmere...@gmail.com wrote: I don't think that web2py will recognize the HTML5 _type=date yet though you could certainly leave it there for your users with an HTML5 compliant browser. Web2py knows which from.vars should be a python date object because of the requires=IS_DATE() in the form field declaration
[web2py] Date intervals split
I need to split a date range into shorter intervalle : Selection=FORM(TABLE(TR( (TD(De l'article,SELECT(_name='DebArt', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))]))), TD(A l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Sélectionner aussi,SELECT(_name='PluArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Exclure les articles,SELECT(_name='NonArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(De la date (-MM-JJ), INPUT(_name='Debut', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(A la date (-MM-JJ), INPUT(_name='Fin',requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Interval (-MM-JJ), INPUT(_name='Interval', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Sélectionner, INPUT(_type='submit',_value='Sélectionner') if Selection.accepts(request.vars,keepvalues=True): pass DebArt=request.vars.DebArt Debut=request.vars.Debut Fin=request.vars.Fin FinArt=request.vars.FinArt NonArt=request.vars.NonArt PluArt=request.vars.PluArt Interval=request.vars.Interval try: Inter=Fin-Interval except: Inter= As you can see I first tried to get an intervalle by the substraction of two request.vars., just to figure id it can works but as expecteed it does not work since Fin and Inter are string types. Fortunately it works with my sqlite type and i can write things like : query=db.table.date=Debut it works sucessfully Yet for splitting the range [Debut-Fin] into many regular shorter intervals, the pb is I don't know how to catch Date type value from the form that will work with the datetime type of dal If someone can give me an idea . Thanks
[web2py] Re: Date intervals split
simpler : Does somebody know how I could transform a field passed via FORM in a datetime dal compliant field ? Thanks a lot ... On 21 fév, 21:56, JmiXIII sylvn.p...@gmail.com wrote: I need to split a date range into shorter intervalle : Selection=FORM(TABLE(TR( (TD(De l'article,SELECT(_name='DebArt', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))]))), TD(A l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Sélectionner aussi,SELECT(_name='PluArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Exclure les articles,SELECT(_name='NonArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(De la date (-MM-JJ), INPUT(_name='Debut', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(A la date (-MM-JJ), INPUT(_name='Fin',requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Interval (-MM-JJ), INPUT(_name='Interval', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Sélectionner, INPUT(_type='submit',_value='Sélectionner') if Selection.accepts(request.vars,keepvalues=True): pass DebArt=request.vars.DebArt Debut=request.vars.Debut Fin=request.vars.Fin FinArt=request.vars.FinArt NonArt=request.vars.NonArt PluArt=request.vars.PluArt Interval=request.vars.Interval try: Inter=Fin-Interval except: Inter= As you can see I first tried to get an intervalle by the substraction of two request.vars., just to figure id it can works but as expecteed it does not work since Fin and Inter are string types. Fortunately it works with my sqlite type and i can write things like : query=db.table.date=Debut it works sucessfully Yet for splitting the range [Debut-Fin] into many regular shorter intervals, the pb is I don't know how to catch Date type value from the form that will work with the datetime type of dal If someone can give me an idea . Thanks
[web2py] Re: Date intervals split
Ooops sorry I did not see the answers On 22 fév, 00:29, JmiXIII sylvn.p...@gmail.com wrote: simpler : Does somebody know how I could transform a field passed via FORM in a datetime dal compliant field ? Thanks a lot ... On 21 fév, 21:56, JmiXIII sylvn.p...@gmail.com wrote: I need to split a date range into shorter intervalle : Selection=FORM(TABLE(TR( (TD(De l'article,SELECT(_name='DebArt', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))]))), TD(A l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Sélectionner aussi,SELECT(_name='PluArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Exclure les articles,SELECT(_name='NonArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(De la date (-MM-JJ), INPUT(_name='Debut', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(A la date (-MM-JJ), INPUT(_name='Fin',requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Interval (-MM-JJ), INPUT(_name='Interval', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Sélectionner, INPUT(_type='submit',_value='Sélectionner') if Selection.accepts(request.vars,keepvalues=True): pass DebArt=request.vars.DebArt Debut=request.vars.Debut Fin=request.vars.Fin FinArt=request.vars.FinArt NonArt=request.vars.NonArt PluArt=request.vars.PluArt Interval=request.vars.Interval try: Inter=Fin-Interval except: Inter= As you can see I first tried to get an intervalle by the substraction of two request.vars., just to figure id it can works but as expecteed it does not work since Fin and Inter are string types. Fortunately it works with my sqlite type and i can write things like : query=db.table.date=Debut it works sucessfully Yet for splitting the range [Debut-Fin] into many regular shorter intervals, the pb is I don't know how to catch Date type value from the form that will work with the datetime type of dal If someone can give me an idea . Thanks
[web2py] Re: Date intervals split
Thanks a lot , too late for testing this evening but I'll try the class solution as soon as possible. At the end , I'd like to select a duration time and splite the interval into regular interval of the selected duration (sorry for my bad english For example : Debut : 2010-01-01 Fin : 2010-12-31 Interval : 6 month #(= -06-00 ?) Then I will make a kind of loop : Debut(1) : 2010-01-01 Fin(1) :2010-06-01 Debut(2) :2010-06-02 Fin(2) :2010-12-31 something like: while debut(x)Debut then debut(x)=debut+interval and so on So now I have two solution : I can catch a time type from form easily Or I make a substraction of two date types (using the class tip) to get my interval type. Thanks On 22 fév, 00:30, JmiXIII sylvn.p...@gmail.com wrote: Ooops sorry I did not see the answers On 22 fév, 00:29, JmiXIII sylvn.p...@gmail.com wrote: simpler : Does somebody know how I could transform a field passed via FORM in a datetime dal compliant field ? Thanks a lot ... On 21 fév, 21:56, JmiXIII sylvn.p...@gmail.com wrote: I need to split a date range into shorter intervalle : Selection=FORM(TABLE(TR( (TD(De l'article,SELECT(_name='DebArt', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))]))), TD(A l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Sélectionner aussi,SELECT(_name='PluArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Exclure les articles,SELECT(_name='NonArt',_multiple='multiple', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(De la date (-MM-JJ), INPUT(_name='Debut', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(A la date (-MM-JJ), INPUT(_name='Fin',requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Interval (-MM-JJ), INPUT(_name='Interval', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Sélectionner, INPUT(_type='submit',_value='Sélectionner') if Selection.accepts(request.vars,keepvalues=True): pass DebArt=request.vars.DebArt Debut=request.vars.Debut Fin=request.vars.Fin FinArt=request.vars.FinArt NonArt=request.vars.NonArt PluArt=request.vars.PluArt Interval=request.vars.Interval try: Inter=Fin-Interval except: Inter= As you can see I first tried to get an intervalle by the substraction of two request.vars., just to figure id it can works but as expecteed it does not work since Fin and Inter are string types. Fortunately it works with my sqlite type and i can write things like : query=db.table.date=Debut it works sucessfully Yet for splitting the range [Debut-Fin] into many regular shorter intervals, the pb is I don't know how to catch Date type value from the form that will work with the datetime type of dal If someone can give me an idea . Thanks
[web2py] Re: Great summary of web2py
Just to give a pleased newbie feed-back : _I'm newbie to web2py (well a couple of month) _I've never studied informatics nor did I have an informatic job BUT I needed something to handle database easely + human interface + network for my job I tried a crack access = beurk = begin to learn python I tried Zope/Plone = too heavy I tried Django = not enough efficient for what I wanted THEN I've seen some comparaison made by Massimo between Django and web2py 'do not remember the url) AND This is these comparisons which decided me to try web2py I'm very pleased because it is so efficient you are right VP , it's a waste of time to fuel the fire. But a short comparison would help newbies to make their choice and choose to try web2py. Yet I'm speaking of comparison showing the efficientness of web2py not long long debates/war. On 23 déc, 23:51, VP vtp2...@gmail.com wrote: On Dec 23, 3:44 am, Branko Vukelić stu...@brankovukelic.com wrote: Or am I missing something? In the summary, also no mention of Django or Flask. My comment is not just about that specific thread of discussion, but about a general PR strategy of web2py. My suggestion to Massimo still stands. Forget about Flask and Django !!! Don't talk about them at all. None. Nothing. People who think that Django/Flask are superior to web2py, and/or web2py is deeply flawed, aren't changing their minds. There's no point to debate, justify, etc. I do not see much benefit for web2py when Massimo discusses Django/ Flask. On the other hand, the (serious) newbies will get lost in hot exchanges between the web2py folks and the Django/Flask folks. Occasionally, this dude Armin will come around the proclaim web2py to be the worst thing there is. And my suggestion to Massimo is that he will have to live with that, and instead of spending energy to justify him, turn that energy into making web2py to be a great platform. Specifically, to attract newbies, I would recommend making Chapter 3 of the book to be better than it currently is. Right now, it's very good. But I think there are places that can be improved. This chapter is where web2py can be/should be showcased to attract the newbies. This comes from my experience when I first learned about web2py.
[web2py] Re: Creating database tables tutorial?
I suggest you to have a look there : http://web2py.com/examples/default/examples = go to example 29 Your first try is a bit 'curious' and I dont think it this what you want to do. Another easy way to experiment web2py is using the wizard: _ Launch the wizard _ Create tables (read the comments) _ Create the fields = generate and have a look to db_wizard.py On 15 déc, 23:02, Hybride mshybr...@gmail.com wrote: Hi everyone, Am currently using SQLite3 but have no issues moving over to MySQL, whichever is easier I guess. I've been trying to create the database tables using the examples on web2py (like the whole pets/dog example), copying and pasting the code from that example into my own application, then trying to generate the tables. I've also tried to create my own tables, with the code: db.define_table('person',Field('person')) Placing that in the controller, and letting it go free. I think you can guess that it was unsuccessful. Is there any tutorial on web2py that shows how to step-by-step create the tables? Do you have to first create the tables in the database itself, then use define_table (I've tried, unsuccessful)? In any case, if anyone could point me in the right direction to said tutorials (or give me the gist of it themselves, in MySQL preferably), that would be greatly appreciated.
[web2py] Re: grid
I'm just discovering it ... Just a remark : here = http://powertable.blouweb.com/products , shouldn't category field render a represent (category.name) instead of category.id ? Not enough time to test a local instance but seems promising... On 15 déc, 23:52, Bruno Rocha rochacbr...@gmail.com wrote: Live demo and download here:http://powertable.blouweb.com/ ALPHA 0.0.0.0.0.0 Version (too much working in progress), Tests and suggestions needed, something can broke, fails or whatever, this is teh first plugin I wrote, and I have too much to enable on this. I am going to publish it to BitBucket and I'll need contributors to work with aesthetics and server side data processing JSON/XML -- Bruno Rochahttp://about.me/rochacbruno/bio
[web2py] Re: Web2py Application Exhibition ( Version 2.0 )
Hello , I've tried to install your tlc2 on 1.89.5, here is the error I get : url : http://127.0.0.1:8080/tlc2/default/index Traceback (most recent call last): File /home/sylvain/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/sylvain/web2py/applications/tlc2/models/ db_booleannet.py, line 23, in module Field('rule', db.booleannet_updaterule, requires = IS_IN_DB(db, 'booleannet_updaterule.id', '%(name)s')), File /home/sylvain/web2py/gluon/validators.py, line 380, in __init__ fields = [self.dbset.db[ktable][k] for k in ks] File /home/sylvain/web2py/gluon/dal.py, line 3644, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name' On 15 déc, 23:51, selecta gr...@delarue-berlin.de wrote: I sure hope you got my mail o_O If not here the most important thing hg clonehttp://tlc2.hg.sourceforge.net:8000/hgroot/tlc2/tlc2 On Nov 16, 4:32 pm, NetAdmin mr.netad...@gmail.com wrote: Rahul, Applications without source code will not be accepted. Maybe in the future we can have a closed source exhibition. Mr.NetAdmin On Nov 14, 11:29 pm, Rahul rahul.dhak...@gmail.com wrote: Hi, Can we submit closed w2p applications without source code? Any specific rules if one does not want to expose the code? Rahul On Nov 12, 5:23 pm, selecta gr...@delarue-berlin.de wrote: How do I submit? Should I just send you (NetAdmin) the code by email? I am working on the project constantly, will you accept updates after the first submission? Or should I wait till the deadline and submit what I got until then? On Nov 11, 9:21 pm, GoldenTiger goldenboy...@gmail.com wrote: I'll be there, actually I am devoting most of my time studyingweb2py. I hope to do a niceapplication. :) On 8 nov, 20:20, Mr admin mr.netad...@gmail.com wrote: Sure! Plugins are just miniature applications right? :-) Mr.NetAdmin On Mon, Nov 8, 2010 at 1:13 PM, mr.freeze nat...@freezable.com wrote: Can we submit be a plugin? On Nov 3, 3:18 pm, NetAdmin mr.netad...@gmail.com wrote: Web2pyApplicationExhibitionVersion2.0 Do you have aWeb2pyapp that you'd like to show the world? If so, you may be interested in theWeb2pyApplicationExhibition. The WAE is a way to... 1. Demonstrate what can be done withWeb2py. 2. Share and learn about usefulweb2py, python, Javascript, jQuery etc. techniques. 3. Earn some money toward that new you've been craving. Projects will be judged in the following areas. Ease of use Usefulness Visual Appeal The Rules 1. Applications must be submitted no later than December 15, 2010 2. Source must be included with your submissions. 3. If theapplicationis written by a team, Massimo can NOT be part of the team. 4. After a 2 week review period, on December 31, 2010, the winners will be announced on theweb2py-users list. 5. The 1st place winner will receive $100 US Dollars, 2nd place will receive $50 6. You must enjoy usingWeb2py! 7. Previous winners must wait 365 days before being eligible to win again. Martin Mulone, the winner of the lastExhibitionwith his entry titled Instant Press, has volunteered to help tally your votes using an application he wrote. ( UsingWeb2pyof course! ) Submissions must be mailed to mr.netad...@gmail.com Good Luck! Mr.NetAdmin at gmail.com
Re: [web2py] grid
Hello Bruno! Seems very fantastic ! I like the in-line editing so much ! I was trying to include most of your features in my own view. Not enough skills to make in-line editing... To my ming your plugin seems much more functionnal to the jquery widget provided with plugin_wiki Looking forward to test it
[web2py] Re: Not really a web2py issue, but need help
That's it I'll try it thanks a lot! On 29 nov, 00:48, mdipierro mdipie...@cs.depaul.edu wrote: I assume you are trying to build a hierarchial tree of articles and you want them all from the parent. I would do this something like this: db.define_table('article',Field('f_parent','reference article'),Field('title')) def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==0: root=row else: rows[row.f_parent].append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children]))) return tree(root) On Nov 28, 5:00 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello, I'm facing I guess a well known programming problem. It is not really related to web2by, but since I'm using web2py I hope somebody here can help. Here is my controller : def global_view(): parents = db(~(db.t_article.id==db.t_list.f_article)).select() tree={} for parent in parents: tree[parent.t_article.id]={} sublevel=db(parent.t_article.id==db.t_list.f_parent).select() for son in sublevel: tree[parent.t_article.id][son.f_article]=son.f_article tree[parent.t_article.id][son.f_article]={} sublevel2=db(son.f_article==db.t_list.f_parent).select() for son2 in sublevel2: tree[parent.t_article.id][son.f_article] [son2.f_article]=son2.f_article tree[parent.t_article.id][son.f_article][son2.f_article]={} return dict(tree=tree) So in fact I'd like to go on for son3, son4, based on the same model as sublevel2... until sublevelx=None. I guess I should use some kind of recursive or loop function. I've read different things using right and left variable for hierarchical tree, but it seems to me that it is possible to build a loop in my controller without modifying my model. Hope I do not disturb this groupes with this kind of question.
[web2py] Re: Not really a web2py issue, but need help
Hello, here is what I did: db.define_table('article', Field('f_parent','reference article'), Field('title')) ## def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==1: root=row else: rows[row.f_parent].append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children])) return tree(root) ## Here are the articles article.id article.f_parentarticle.title 1 1 Racine 2 1 Branche1 3 1 Branche2 It gives me the following error : Traceback (most recent call last): File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \restricted.py, line 188, in restricted exec ccode in environment File C:/Documents and Settings/sylvain/Bureau/web2py2/applications/ test/controllers/default.py, line 66, in module File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File C:/Documents and Settings/sylvain/Bureau/web2py2/applications/ test/controllers/default.py, line 60, in index else: rows[row.f_parent].append(row) File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \sql.py, line 742, in __getattr__ return dict.__getitem__(self,key) KeyError: 'append' T tried to modify : else: rows[row.f_parent].append(row) with else: rows[row.children].append(row) as it seems we're trying to build a list of children. Yet i get another error : TypeError: list objects are unhashable Can anybody help me ? On 29 nov, 12:27, JmiXIII sylvn.p...@gmail.com wrote: That's it I'll try it thanks a lot! On 29 nov, 00:48, mdipierro mdipie...@cs.depaul.edu wrote: I assume you are trying to build a hierarchial tree of articles and you want them all from the parent. I would do this something like this: db.define_table('article',Field('f_parent','reference article'),Field('title')) def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==0: root=row else: rows[row.f_parent].append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children]))) return tree(root) On Nov 28, 5:00 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello, I'm facing I guess a well known programming problem. It is not really related to web2by, but since I'm using web2py I hope somebody here can help. Here is my controller : def global_view(): parents = db(~(db.t_article.id==db.t_list.f_article)).select() tree={} for parent in parents: tree[parent.t_article.id]={} sublevel=db(parent.t_article.id==db.t_list.f_parent).select() for son in sublevel: tree[parent.t_article.id][son.f_article]=son.f_article tree[parent.t_article.id][son.f_article]={} sublevel2=db(son.f_article==db.t_list.f_parent).select() for son2 in sublevel2: tree[parent.t_article.id][son.f_article] [son2.f_article]=son2.f_article tree[parent.t_article.id][son.f_article][son2.f_article]={} return dict(tree=tree) So in fact I'd like to go on for son3, son4, based on the same model as sublevel2... until sublevelx=None. I guess I should use some kind of recursive or loop function. I've read different things using right and left variable for hierarchical tree, but it seems to me that it is possible to build a loop in my controller without modifying my model. Hope I do not disturb this groupes with this kind of question.
[web2py] Re: Not really a web2py issue, but need help
Works fine , thanks I saw it was a recurrent question, maybe you should add this in the book On 29 nov, 18:51, mdipierro mdipie...@cs.depaul.edu wrote: my bad def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==1: root=row else: rows[row.f_parent].children.append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children])) return tree(root) On Nov 29, 11:06 am, JmiXIII sylvn.p...@gmail.com wrote: Hello, here is what I did: db.define_table('article', Field('f_parent','reference article'), Field('title')) ## def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==1: root=row else: rows[row.f_parent].append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children])) return tree(root) ## Here are the articles article.id article.f_parent article.title 1 1 Racine 2 1 Branche1 3 1 Branche2 It gives me the following error : Traceback (most recent call last): File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \restricted.py, line 188, in restricted exec ccode in environment File C:/Documents and Settings/sylvain/Bureau/web2py2/applications/ test/controllers/default.py, line 66, in module File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File C:/Documents and Settings/sylvain/Bureau/web2py2/applications/ test/controllers/default.py, line 60, in index else: rows[row.f_parent].append(row) File C:\Documents and Settings\sylvain\Bureau\web2py2\gluon \sql.py, line 742, in __getattr__ return dict.__getitem__(self,key) KeyError: 'append' T tried to modify : else: rows[row.f_parent].append(row) with else: rows[row.children].append(row) as it seems we're trying to build a list of children. Yet i get another error : TypeError: list objects are unhashable Can anybody help me ? On 29 nov, 12:27, JmiXIII sylvn.p...@gmail.com wrote: That's it I'll try it thanks a lot! On 29 nov, 00:48, mdipierro mdipie...@cs.depaul.edu wrote: I assume you are trying to build a hierarchial tree of articles and you want them all from the parent. I would do this something like this: db.define_table('article',Field('f_parent','reference article'),Field('title')) def index(): rows = dict((r.id,r) for r in db(db.article).select()) for id,row in rows.items(): row.children=[] for id,row in rows.items(): if row.f_parent==0: root=row else: rows[row.f_parent].append(row) def tree(row): return DIV(H1(row.title),UL(*[LI(tree(child)) for child in row.children]))) return tree(root) On Nov 28, 5:00 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello, I'm facing I guess a well known programming problem. It is not really related to web2by, but since I'm using web2py I hope somebody here can help. Here is my controller : def global_view(): parents = db(~(db.t_article.id==db.t_list.f_article)).select() tree={} for parent in parents: tree[parent.t_article.id]={} sublevel=db(parent.t_article.id==db.t_list.f_parent).select() for son in sublevel: tree[parent.t_article.id][son.f_article]=son.f_article tree[parent.t_article.id][son.f_article]={} sublevel2=db(son.f_article==db.t_list.f_parent).select() for son2 in sublevel2: tree[parent.t_article.id][son.f_article] [son2.f_article]=son2.f_article tree[parent.t_article.id][son.f_article][son2.f_article]={} return dict(tree=tree) So in fact I'd like to go on for son3, son4, based on the same model as sublevel2... until sublevelx=None. I guess I should use some kind of recursive or loop function. I've read different things using right and left variable for hierarchical tree, but it seems to me that it is possible to build a loop in my controller without modifying my model. Hope I do not disturb this groupes with this kind of question.
[web2py] Not really a web2py issue, but need help
Hello, I'm facing I guess a well known programming problem. It is not really related to web2by, but since I'm using web2py I hope somebody here can help. Here is my controller : def global_view(): parents = db(~(db.t_article.id==db.t_list.f_article)).select() tree={} for parent in parents: tree[parent.t_article.id]={} sublevel=db(parent.t_article.id==db.t_list.f_parent).select() for son in sublevel: tree[parent.t_article.id][son.f_article]=son.f_article tree[parent.t_article.id][son.f_article]={} sublevel2=db(son.f_article==db.t_list.f_parent).select() for son2 in sublevel2: tree[parent.t_article.id][son.f_article] [son2.f_article]=son2.f_article tree[parent.t_article.id][son.f_article][son2.f_article]={} return dict(tree=tree) So in fact I'd like to go on for son3, son4, based on the same model as sublevel2... until sublevelx=None. I guess I should use some kind of recursive or loop function. I've read different things using right and left variable for hierarchical tree, but it seems to me that it is possible to build a loop in my controller without modifying my model. Hope I do not disturb this groupes with this kind of question.
[web2py] Jqgrid via plugin_wiki and reference
Hello, I'm happy with the plugin_wiki jqgrid widget. Yet consider(genrated from wizard): db.define_table('t_piece', Field('id','id', represent=lambda id:SPAN(id,' ',A('view',_href=URL('piece_read',args=id, Field('f_code', type='string', unique=True, label=T('Code')), Field('f_reception', 'date', label=T('Reception')), Field('f_type', type='reference t_modele', label=T('Type')), Field('f_rque', type='string', label=T('Rque')), Field('f_etat', type='string', label=T('Etat')), Field('active','boolean',default=True, label=T('Active'),writable=False,readable=False), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), Field('created_by',db.auth_user,default=auth.user_id, label=T('Created By'),writable=False,readable=False), Field('modified_by',db.auth_user,default=auth.user_id, label=T('Modified By'),writable=False,readable=False, update=auth.user_id), format='%(f_code)s', migrate=settings.migrate) db.define_table('t_modele', Field('id','id', represent=lambda id:SPAN(id,' ',A('view',_href=URL('modele_read',args=id, Field('f_nom', type='string', label=T('Nom')), Field('f_qstock', type='string', label=T('Qstock')), Field('f_qmin', type='string', label=T('Qmin')), Field('f_descriptif', type='string', label=T('Descriptif')), Field('f_materiel', type='list:reference t_materiel', label=T('Materiel')), Field('f_fournisseur', type='string', label=T('Fournisseur')), Field('f_px_unit', type='string', label=T('Px Unit')), Field('active','boolean',default=True, label=T('Active'),writable=False,readable=False), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), Field('created_by',db.auth_user,default=auth.user_id, label=T('Created By'),writable=False,readable=False), Field('modified_by',db.auth_user,default=auth.user_id, label=T('Modified By'),writable=False,readable=False, update=auth.user_id), format='%(f_nom)s', migrate=settings.migrate) When I use in a view (loop): {{=db.t_piece.f_type.represent(row.f_type)}} everything is all right I get f_nom for f_type representation. now consider: {{=plugin_wiki.widget('jqgrid',table='t_piece')}} Values of db.t_piece_f_type are correctly represented but : If I want to use the search function with db.t_piece.f_type, I will have to search for db.t_model.id and not db.t_model.f_nom Is there a way to achieve this ? Thanks for this great framework.
[web2py] Re: Unable to edit language files
Salut ! :) What about having a look there :) https://groups.google.com/group/web2py-users-france?hl=fr On 17 nov, 06:06, pierreth pierre.thibau...@gmail.com wrote: On Nov 16, 6:23 pm, mdipierro mdipie...@cs.depaul.edu wrote: I am still trying to understand why this is a problem. web2py loads the langauge in ram, and uses. It finds a T(var) and var is not in dictionary, it assumes it needs to be translated, adds it to the dict and saves it on file. Somehow your code breaks this. How? What is the purpose of your code? Where is it, in a model? OK, I did a re-factoring of my code and everything is now fine and I have no bug. No more worry. My application is in English with translation in French. I wanted to be able to use codes for long texts. This means to always do the translation and look up in the en.py file when I use these codes. Also, I wanted to use specific language files in some cases. Now, my application works in French. Would you like the file? It enables web2py in French.
[web2py] Re: problem whith admin
Hello , I had the same pb : Traceback (most recent call last): File /home/sylvain/web2py/gluon/restricted.py, line 188, in restricted exec ccode in environment File /home/sylvain/web2py/applications/admin/views/default/ design.html, line 290, in module /div IndexError: list index out of range What I can say : I had Jqueryui folder in my /static and /plugin_wiki also When I remove jqueryui from /static it works fine... Don't know if it can helps, I wonder if it is a redondant file pb... On 15 nov, 22:43, Nico de Groot ndegr...@chello.nl wrote: I think the offending line is in design.html, see the ticket below. (The 'real' line number is 207, because the python code is generated by {{=...}}.) 289. if '/'.join(file_path).startswith('/'.join(path)): At that point path: ['js', 'ckeditor', 'plugins', 'table'] and file_path: ['js', 'ckeditor', 'plugins', 'tableresize'] the joins in de code result in js/ckeditor/plugins/tableresize and js/ckeditor/plugins/table I think line 289 intents to check if the 'path' is a 'path-prefix' of 'file_path'. In this case the check resolves to True, but this incorrect, because it is NOT a path-prefix causing line 290 to fail. line 289 should probably be something like: if ('/'.join(file_path)+'/').startswith('/'.join(path)+'/') or path==[]: This seems to resolve at least my problem. Please test and confirm. Nico - Excerpt from my error-ticket: type 'exceptions.IndexError'(list index out of range) File C:\web2py\applications\admin\views\default\design.html in module at line 290 code Code listing 282. response.write('\n ul\n ', escape=False) 283. path=[] 284. for file in statics+['']: 285. items=file.split('/') 286. file_path=items[:-1] 287. filename=items[-1] 288. while path!=file_path: 289. if '/'.join(file_path).startswith('/'.join(path)): 290. path.append(file_path[len(path)]) On 15 nov, 20:10, Branko Vukelic bg.bra...@gmail.com wrote: On Mon, Nov 15, 2010 at 8:59 PM, mdipierro mdipie...@cs.depaul.edu wrote: where is the offending line in design.html? I think it's in this block: h3 id=plugins onclick=collapse('plugins_inner'); class=component {{=T(Plugins)}} span class=tooltip{{=helpicon()}} span{{=T(To create a plugin, name a file/folder plugin_[name])}}/span/span /h3 div id=plugins_inner class=component_contents div class=controls comptools {{=button(PLUGINS_APP, T('download plugins'))}} /div div class=controls /div {{if plugins:}} ul {{for plugin in plugins:}} li {{=A('plugin_%s' % plugin, _class='file', _href=URL('plugin', args=[app, plugin]))}} /li {{pass}} /ul {{else:}} pstrong{{=T('There are no plugins')}}/strong/p {{pass}} div class=controls formfield{{=upload_plugin_form(app)}}/div /div -- line 290 -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group
[web2py] Re: new demo appliance for gmap and fullcalendar
Nice example... Just a note : Line 25 of mycal.html stop: new Date('{{=row.f_end_time.strftime('%B %d, %Y %H:%M:%S')}}'), should be: end: new Date('{{=row.f_end_time.strftime('%B %d, %Y %H:%M:%S')}}'), So events longer than a day render correctly. On 10 nov, 16:35, mdipierro mdipie...@cs.depaul.edu wrote: http://web2py.com/appliances/default/show/71
[web2py] multiple select contains
Hello, I'm juste trying to use contains with a custom FORM, but it does not work with FORM(SELECT,_multiple=True Here is a piece of my controller: def rebuts(): #Formulaire de saisie des rebust ListeArticle=db(db.Article.id0).select(orderby=db.Article.CodeArticle) Selection=FORM(TABLE(TR( (TD(De l'article,SELECT(_name='DebArt', *[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))]))), TD(A l'article,SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(Test,SELECT(_name='Test',_multiple=True,*[OPTION(ListeArticle[i].CodeArticle, _value=str(ListeArticle[i].CodeArticle)) for i in range(len(ListeArticle))])), TD(De la date (-MM-JJ), INPUT(_name='Debut', requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(A la date (-MM-JJ), INPUT(_name='Fin',requires = IS_DATE(error_message=T('Doit être de la forme -MM-JJ !', TD(Sélectionner, INPUT(_type='submit',_value='Sélectionner') if Selection.accepts(request.vars,keepvalues=True): pass DebArt=request.vars.DebArt Debut=request.vars.Debut Fin=request.vars.Fin FinArt=request.vars.FinArt Test=request.vars.Test [...] query5=db(db.GPOF.OF_CART.contains(Test)).select() [...] return dict(query5=query5,Test=Test) If I submit one value to the Test field = query5 act as I want (=returns db.GPOF whose field OF_CART=Test) If I submit more than one value to the Test Field = query5 does not return anything. I guess this question have already been asked around there but I cannot find it through the group. Can somebody help me with this , I'd like to returen all rows db.GP_OF whose field are selected via the Test multiple select field Thanks a lot
[web2py] Re: LOAD... and jquerytools
Well in fact it does not render for N°1=N°3 in my code Yet I'm not used to using javascript and ajax and does not know firebug enough. But here is the code rendered : table class=nc tr thDate/Heure/th thcontrole 1/th thcontrole 2/th thdiv id=c258613760639Hello World/divscript type=text/javascript/script N°1/th /tr tr td.../td tdenreg 1/td tdenreg 2/td /tr /table As I can find the {{=LOAD('default','index.load')}} this is not a web2py issue. I Just have find why this div does not render. Thanks On 8 août, 19:32, mdipierro mdipie...@cs.depaul.edu wrote: Please clarify what you mean by does not work. Did you try firebug? is the ajax call executed? Do you get a response? If so, it is a JS problem. On Aug 8, 7:19 am, JmiXIII sylvn.p...@gmail.com wrote: Hello ! Here is a view in which I am using LOAD helper I have put {{=LOAD('default','index.load')}} N°# in several places in the code below I am also using jquerytools :http://cdn.jquerytools.org/1.2.1/jquery.tools.min.js from my controler The only {{=LOAD('default','index.load')}} working is N°#4 outside the div affected by jquerytools Can someone explain me why the other doesn't work ? Does that mean I can't use LOAD with jquerytools ? Thanks a lot {{extend 'layout.html'}} h2{{=Selection}}/h2 h1{{=CArt}}{{=ArtOF}}/h1 !-- tabs -- ul class=css-tabs lia href=#Suivi Prod/a/li lia href=#Synthèse OF/a/li lia href=#Non conformités/a/li lia href=#Suivi de contrôle/a/li /ul !-- panes -- div class=css-panes div stuffs /div div stuffs /div div stuffs /div div table class=nc tr thDate/Heure/th thcontrole 1/th thcontrole 2/th th{{=LOAD('default','index.load')}} N°1/th /tr tr td.../td tdenreg 1/td tdenreg 2/td /tr /table {{=LOAD('default','index.load')}} N°2 /div {{=LOAD('default','index.load')}} N°3 /div {{=LOAD('default','index.load')}} N°4 !-- activate tabs with JavaScript -- script $(function() { // :first selector is optional if you have only one tabs on the page $(.css-tabs:first).tabs(.css-panes:first div);}); /script
[web2py] Re: load_action information
Now I've tried this after updating to the last version and after having seen What is going on with web2py. `` name: load_action action: saisie.load controller: default ajax: True ``:widget and it works fine. Thanks Massimo Now does any body knows if there is a way to keep the initial view saisie.html rendered in my wiki page ? On 19 juil, 21:58, JmiXIII sylvn.p...@gmail.com wrote: Hello , I'm trying to understand how load_action works in plugin_wiki. I thought I had to put something like : `` name: load_action action: index controller: grille ajax: True ``:widget Yet it renders a template of URL(a,c,f) over a first template... would have been so nice ... Is there any chance to render URL(a,c,f,args,vars) in a wiki page ?
[web2py] Re: load_action information
Sorry I have just find what I wanted: Let's say I have: `` name: load_action action: saisie controller: default ajax: True ``:widget where : def saisie(): return dict(stuff=stuff) saisie.html is : {{extend 'layout.html'}} h2{{=Selection}}/h2 h1{{=CArt}}{{=ArtOF}}/h1. I just needed to do this in saisie.html : h2{{=Selection}}/h2 h1{{=CArt}}{{=ArtOF}}/h1... and every thing is all right my view is embed without beeing twice rendered by the way in saisie.html, this !-- {{extend 'layout.html'}} -- h2{{=Selection}}/h2 h1{{=CArt}}{{=ArtOF}}/h1... does not produce the same result (jquery stuff appears)
[web2py] Re: css of welcome app not adapted for Chrome??
Hi , Just a word to say that I've faced the same problem. I just hit refresh and it works fine. But I've faced this pb also with other site with chrome. It's stupid but to my mind it seems the template render before the css is refreshed. Each time I just had to refresh and things got wright. Yet I cant remember which sites were concerned. As far as I can remember I haven't seen that on my windows/firefox Configuration : Linux x86_64 Chromium compiled (don't have the version here) If it can help. On 20 juil, 09:53, mdipierro mdipie...@cs.depaul.edu wrote: I cannot reproduce the problem. I use Chrome on Mac. from your picture looks like these lines in base.css are being ignored: #layout { background: white; } #header, #footer { color: white; background: url('images/header.png') repeat #11;} Any more insight would be helpful.Which css instruction is being ignored? Massimo On Jul 19, 1:32 pm, Jean-Guy jean...@gmail.com wrote: What I have with Chrome under Ubuntu : attached Jonhy On 2010-07-19 13:15, Jonathan Lundell wrote: On Jul 19, 2010, at 9:45 AM, Jean-Guy wrote: I just install 1.81.4 and open the welcome app with Google Chrome and the layout is pretty weird... With Firefox no problem. What version is web2py.com running (and how does one find out?)? It looks OK to me with Firefox, Safari Chrome (OS X). Two minor display problems, though, Massimo. 1. On the main web2py.com pages, the link 'web2py' in the footer is unreadable (orange on orange). There needs to be a style override for link within footer. 2. In the welcome app, the flash block covers up the top right menu unless the window is set rather wide. Capture.png 104KViewDownload
[web2py] load_action information
Hello , I'm trying to understand how load_action works in plugin_wiki. I thought I had to put something like : `` name: load_action action: index controller: grille ajax: True ``:widget Yet it renders a template of URL(a,c,f) over a first template... would have been so nice ... Is there any chance to render URL(a,c,f,args,vars) in a wiki page ?
[web2py] Re: openwysiwyg?
I've tried it but I left it , not usefull
[web2py] Re: loop generated forms
Try to use : return dict (a=b) Maybe you need to have a look there : http://docs.python.org/library/stdtypes.html#dict On 13 juil, 00:19, Jonathan Lundell jlund...@pobox.com wrote: On Jul 12, 2010, at 3:04 PM, Rick wrote: Thanks for your inspiring answer, After I found this page: http://code.activestate.com/recipes/440502-a-dictionary-with-multiple... ...I tried with: return dict['form'].append([x]) ...but my new code doesn't work neither. I just get TypeError: 'type' object is unsubscriptable. Don't use the word 'dict'. Though I think this code is nearer the solution. On Jul 12, 10:44 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello , I've used something like this : def listform(): listf=[] thing = [one two three] for x in thing: form=FORM(':', INPUT(_name=name)) listf.append(form) return dict(listf=listf) Yet I usually use SQLFORM and add a submit button As this is my firts answer to a coding question, do not hesitate to tell if I'm wrong On 12 juil, 22:26, Rick sababa.sab...@gmail.com wrote: Hi, How to generate multiple forms with a loop? In my controller file there are forms generated with this loop: thing=[one, two, three] def theFunction(): for thing1 in varibale1: form=FORM(':', INPUT(_name='name') ) return dict(form=form) ...but this code doesn't work. I just get the message invalid view. I suppose the reason that I get this message is that all the forms have the same name in the view file. Therefor I also tried with: return dict(form=[thing]) ...but got: SyntaxError: keyword can't be an expression I've tried with this code in the view file: {{extend 'layout.html'}} h2{{=form}}/h2 ...and also with this: {{extend 'layout.html'}} h2 {{thing=[one, two, three]}} {{for thing1 in varibale1:}} {{=form}} /h2 ...but none of them worked. Thanks in advance for help
[web2py] Re: loop generated forms
Hello , I've used something like this : def listform(): listf=[] thing = [one two three] for x in thing: form=FORM(':', INPUT(_name=name)) listf.append(form) return dict(listf=listf) Yet I usually use SQLFORM and add a submit button As this is my firts answer to a coding question, do not hesitate to tell if I'm wrong On 12 juil, 22:26, Rick sababa.sab...@gmail.com wrote: Hi, How to generate multiple forms with a loop? In my controller file there are forms generated with this loop: thing=[one, two, three] def theFunction(): for thing1 in varibale1: form=FORM(':', INPUT(_name='name') ) return dict(form=form) ...but this code doesn't work. I just get the message invalid view. I suppose the reason that I get this message is that all the forms have the same name in the view file. Therefor I also tried with: return dict(form=[thing]) ...but got: SyntaxError: keyword can't be an expression I've tried with this code in the view file: {{extend 'layout.html'}} h2{{=form}}/h2 ...and also with this: {{extend 'layout.html'}} h2 {{thing=[one, two, three]}} {{for thing1 in varibale1:}} {{=form}} /h2 ...but none of them worked. Thanks in advance for help
[web2py] cube2py
Hello, I've just tried to import plugin_wiki in my app. It seems to work nice and I think it will help me a lot. Yet I've tried Crud via ``create. and list via ``jqgrid... * Would it be possible to have a full Crud interface with the jqgrid (I've noticed that create, del are set to false in plugin_wiki.py) * It seems that order,find,list (20,50,100) selection and other actions does not work, I can only see the list. Is it normal ? or should I add some code elsewhere ? Eventually another helpfull idea (for me) would be to incorporate directly views from web2py in the wiki. Anyway very good job done ! thanks
[web2py] Re: cube2py
Ok I was wondering if I missed something. Sorry I'm not a good hacker, but I'll try to patch it On 11 juil, 20:21, mdipierro mdipie...@cs.depaul.edu wrote: On 11 Lug, 09:29, JmiXIII sylvn.p...@gmail.com wrote: Hello, I've just tried to import plugin_wiki in my app. It seems to work nice and I think it will help me a lot. Yet I've tried Crud via ``create. and list via ``jqgrid... * Would it be possible to have a full Crud interface with the jqgrid (I've noticed that create, del are set to false in plugin_wiki.py) * It seems that order,find,list (20,50,100) selection and other actions does not work, I can only see the list. Is it normal ? or should I add some code elsewhere ? It is in the queue. :-) If you have a patch that can speed this up, please send it. Eventually another helpfull idea (for me) would be to incorporate directly views from web2py in the wiki. Anyway very good job done ! thanks
[web2py] Re: Do you use web2py in your company?
I'm using web2py in replacement of an access application I had before. It aims at providing a simple production record process for a plastic injection factory (less than 35 employees). It is binded via csv read to our ERP Produflex (FoxPro database). Now it supports production performance and quality related actions for end users. It is closely binded to Produflex so I do not think the source is interesting. Moreover as a non programmer I did not follow the good practices so I think my code is a bit awful (but documented). I tried before Joomla, Plone (with archgenxml). I must add that Plomino for plone (based on Lotus domino) is a very nice product. But I finally realised I needed a lower and faster access to my application. I also wanted to keep my data easely readable from outside the application. I lookforward to adding more stuff like consulting product specification (stored on external files like word, excel), but without breaking the existing structure. Best regards JmiXIII PS : sorry dor my english
[web2py] SQLFORM update with a custom html form
Hello, I'm using a SQLFORM with a html custom (as described in book/7.2 = SQLFORM in HTML) My fonction inside my controller is : def ncmodif(): ### Formulaire de saisie des NC de production rec=db(db.NC.id==269).select()[0] form=SQLFORM(db.NC,record=rec) if form.accepts(request.vars, formname='test'): response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill the form' return dict() I have hardcoded db.NC.if==269 for the moment to see how it works. My view is something like: forminput name=FieldName/input type=hidden name=_formname value=test / My question is there a simple way to make this form work as it works with the standard way (ie when using {{=form}}) to update the record via the custom form ? Can I have the input field prepopulated and updated when I submit since ncmodif() does not return any value ? Thanks -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] passing vars ....
Here I am once again. I've tried to find the explanation of the following fact but did not manage. I Have the following code in my controller: def saisie(): ... CodeOF=request.vars.OF or request.vars.META_OF Selection=FORM('Code OF:', INPUT(_name='OF',_value=CodeOF,requires=IS_IN_DB(db, 'GPOF.OF_CODE')), o INPUT(_type='submit',_value='Cliquer pour afficher')) #Formulaire de filtre if Selection.accepts(request.vars,keepvalues=True): pass ... It helps me filtering the view. Anyway when I submit the url is something /SuiviProd/default/saisie. I still wonder why it is not / SuiviProd/default/saisie?OF= . But that works fine The pb is I need to access to this view from elsewhere passing the vars=dict(OF=xx). So I get the rendered view : /SuiviProd/default/ saisie?OF=xx , the view is correct. But If submit Selection again then web2py complains about the fact : TypeError: int() argument must be a string or a number, not 'list' I guess that resquest.vars get the vars url and the Selection vars. I tried using request.post_vars but that is the same. So my question is how can I pass my vars without the url (as it is done via the saisie fonction) Hope you understood me. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: texarea in SQLFORM formatting
Works fine thank you Congratulation for your framework and the service provided via the google-group On 15 mar, 16:21, mdipierro mdipie...@cs.depaul.edu wrote: There is this in base.css input.string { width: 420px; } textarea.text { width: 420px; height: 200px; } That is why the _size is ignored. You can remove the code in base.css or use css, instead of _size. On Mar 15, 10:18 am, JmiXIII sylvn.p...@gmail.com wrote: You're right this a string field , but when I tried to use first [_size] to format it like the other fields... but it does not work, the field is always the same length. I have the same pb with another string field. I am rendering them in a table with no attrivutes, so I do not think that matter. I'm using SQLite. Here is my model db.define_table(LigneOF, SQLField(OF, integer), SQLField(Date,date, default=None), SQLField(Equipe,integer, requires=IS_IN_SET(['1','2','3'])), SQLField(Cdebut,integer, requires=IS_LENGTH(6)), SQLField(Cfin,integer, requires=IS_LENGTH(6)), SQLField(Qrebuts,integer, requires=IS_LENGTH(6)), SQLField(Rques,string)) and the controller : Form2=SQLFORM(db.LigneOF,fields=['Date' ,'Equipe', 'Cdebut', 'Cfin','Qrebuts','Rques'],hidden=dict(OF=CodeOF),submit_button='Sauver') Form2.vars.OF=CodeOF for champs in ['Date' ,'Cdebut', 'Cfin','Qrebuts','Rques']: Form2.element(_name=champs)['_size']=9 if Form2.accepts(request.vars): response.flash = 'Données saisies' -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] texarea in SQLFORM formatting
Hello, I'd like to format a string field in my view of a SQLFORM. I manage to do it via : form.element(_name='field')['_attribute']=x Whereas it works fine for a datetime and an integer field, it doesn't work for a string field, which I suppose is render with a textarea widget. Here is an exemple of what I did: Form2=SQLFORM(db.LigneOF,fields= ['Date','Equipe','Cdebut','Cfin','Qrebuts','Rques'], hidden=dict(OF=CodeOF), submit_button='Sauver') Form2.vars.OF=CodeOF for champs in ['Date' ,'Cdebut', 'Cfin','Qrebuts']: Form2.element(_name=champs)['_size']=9 Form2.element(_name='Rques')['_rows']=2 The last line (field 'Rques') doesn't work, could you give an idea why ? Thank you PS : I use also {{=Form2.custom.begins}}. {{=Form2.custom.widget.field}} for rendering my form -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: texarea in SQLFORM formatting
You're right this a string field , but when I tried to use first [_size] to format it like the other fields... but it does not work, the field is always the same length. I have the same pb with another string field. I am rendering them in a table with no attrivutes, so I do not think that matter. I'm using SQLite. Here is my model db.define_table(LigneOF, SQLField(OF, integer), SQLField(Date,date, default=None), SQLField(Equipe,integer, requires=IS_IN_SET(['1','2','3'])), SQLField(Cdebut,integer, requires=IS_LENGTH(6)), SQLField(Cfin,integer, requires=IS_LENGTH(6)), SQLField(Qrebuts,integer, requires=IS_LENGTH(6)), SQLField(Rques,string)) and the controller : Form2=SQLFORM(db.LigneOF,fields=['Date' ,'Equipe', 'Cdebut', 'Cfin','Qrebuts','Rques'],hidden=dict(OF=CodeOF),submit_button='Sauver') Form2.vars.OF=CodeOF for champs in ['Date' ,'Cdebut', 'Cfin','Qrebuts','Rques']: Form2.element(_name=champs)['_size']=9 if Form2.accepts(request.vars): response.flash = 'Données saisies' -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Form working on create not on update ....
I'm facing a pb with the following controller : # Formulaire de saisie principal from gluon.tools import Crud crud = Crud(globals(), db) def saisie(): listeOF=db(db.GPOF.id0).select() CodeOF=request.vars.OF Selection=FORM('Code OF:', INPUT(_name='OF',_value=CodeOF,requires=IS_IN_DB(db, 'GPOF.OF_CODE')), INPUT(_type='submit',_value='Cliquer pour afficher')) if Selection.accepts(request.vars,keepvalues=True): pass MetaOF=db(db.OF.META_OF==CodeOF).select() #Sélection des données méta de l'OF (démarrage, responsable...) if len(MetaOF): MetaForm=SQLFORM(db.OF,record=MetaOF[0],deletable=True) else: MetaForm=SQLFORM(db.OF) if MetaForm.accepts(request.vars,session): response.flash = 'Données saisies' return dict(Selection=Selection,MetaForm=MetaForm) The selection form works well and helps filtering data (this controller is extracted from a bigger one). When len(MetaOF)=0 , it's ok , a new record is inserted When len(MetaOF)=1, it render the right record but if I try to modify it , it doesn't work (no error message) but no response.flash neither Could you help me understant what's wrong Thanks JmiXIII -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Form working on create not on update ....
Hello, Well I've tried CodeOF=request.vars.OF or request.vars.META_OF but it does not change anything Using the appadmin works (I can update records of db.OF) Here is my model: db.define_table(OF, SQLField(META_OF, integer), SQLField(META_RespOF,string), SQLField(META_Affectation, string), SQLField(META_Debut, datetime), SQLField(META_Fin, datetime), SQLField(META_QTranfert, integer)) db.define_table(GPOF, SQLField(OF_CODE, integer,notnull=False, default=None), SQLField(OF_CART, string,notnull=False, default=None), SQLField(OF_QUAN, double,notnull=False, default=None)) I've put a {{=BEAUTIFY(request.vars)}} at the end of my view and I can check that each field (Meta_*) of my MetaForm seems to be passed when I submit MetaForm, so I do not understand why it is not updated in the database Thanks for your help On 12 mar, 22:10, mdipierro mdipie...@cs.depaul.edu wrote: Need to see the model to make sure but try replace CodeOF=request.vars.OF with CodeOF=request.vars.OF or request.vars.META_OF The problem that when the second form is submitted vars.OF is None so there no record to edit. On Mar 12, 2:03 pm,JmiXIIIsylvn.p...@gmail.com wrote: I'm facing a pb with the following controller : # Formulaire de saisie principal from gluon.tools import Crud crud = Crud(globals(), db) def saisie(): listeOF=db(db.GPOF.id0).select() CodeOF=request.vars.OF Selection=FORM('Code OF:', INPUT(_name='OF',_value=CodeOF,requires=IS_IN_DB(db, 'GPOF.OF_CODE')), INPUT(_type='submit',_value='Cliquer pour afficher')) if Selection.accepts(request.vars,keepvalues=True): pass MetaOF=db(db.OF.META_OF==CodeOF).select() #Sélection des données méta de l'OF (démarrage, responsable...) if len(MetaOF): MetaForm=SQLFORM(db.OF,record=MetaOF[0],deletable=True) else: MetaForm=SQLFORM(db.OF) if MetaForm.accepts(request.vars,session): response.flash = 'Données saisies' return dict(Selection=Selection,MetaForm=MetaForm) The selection form works well and helps filtering data (this controller is extracted from a bigger one). When len(MetaOF)=0 , it's ok , a new record is inserted When len(MetaOF)=1, it render the right record but if I try to modify it , it doesn't work (no error message) but no response.flash neither Could you help me understant what's wrong Thanks JmiXIII -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Form working on create not on update ....
Sorry for my last message , it works Ok (I did not routed to my test controler) Thanks a lot JmiXIII On 12 mar, 22:10, mdipierro mdipie...@cs.depaul.edu wrote: Need to see the model to make sure but try replace CodeOF=request.vars.OF with CodeOF=request.vars.OF or request.vars.META_OF The problem that when the second form is submitted vars.OF is None so there no record to edit. On Mar 12, 2:03 pm,JmiXIIIsylvn.p...@gmail.com wrote: I'm facing a pb with the following controller : # Formulaire de saisie principal from gluon.tools import Crud crud = Crud(globals(), db) def saisie(): listeOF=db(db.GPOF.id0).select() CodeOF=request.vars.OF Selection=FORM('Code OF:', INPUT(_name='OF',_value=CodeOF,requires=IS_IN_DB(db, 'GPOF.OF_CODE')), INPUT(_type='submit',_value='Cliquer pour afficher')) if Selection.accepts(request.vars,keepvalues=True): pass MetaOF=db(db.OF.META_OF==CodeOF).select() #Sélection des données méta de l'OF (démarrage, responsable...) if len(MetaOF): MetaForm=SQLFORM(db.OF,record=MetaOF[0],deletable=True) else: MetaForm=SQLFORM(db.OF) if MetaForm.accepts(request.vars,session): response.flash = 'Données saisies' return dict(Selection=Selection,MetaForm=MetaForm) The selection form works well and helps filtering data (this controller is extracted from a bigger one). When len(MetaOF)=0 , it's ok , a new record is inserted When len(MetaOF)=1, it render the right record but if I try to modify it , it doesn't work (no error message) but no response.flash neither Could you help me understant what's wrong Thanks JmiXIII -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.