[web2py] one2many DB, delete() deleteing sons ?

2011-08-16 Thread TomPliss
Hey guys, (newbie here) I'm working on a batabase, with many one2many relationship. exemple : "labs" have "equipments", which have "devices". and "contracts" have "equipments" too (as they are maintenance contracts). the problem is : if I delete a contract, every equipments which refers to it i

[web2py] Re: one2many DB, delete() deleteing sons ?

2011-08-16 Thread TomPliss
Give it a try. > You may have to reset the database. > Please let us know if this solved the problem. > > On Aug 16, 4:06 am, TomPliss wrote: > > > > > > > > > Hey guys, > > > (newbie here) > > > I'm working on a batabase, with many one2man

[web2py] Re: How to insert icons into a column of a table created using SQLTABLE()

2011-08-16 Thread TomPliss
Can't you use the represent field of the column, to show an image ? On Aug 17, 7:44 am, Bruno Rocha wrote: > use virtualfields for that. > > class Virtual(object) >         def my16pximage(self): >              return IMG(_src=URl(...)) > > db.table.virtualfields.append(Virtual()) > > table = SQL

[web2py] Re: ajax Jquery code for button

2011-08-16 Thread TomPliss
Hey (little noob here), If you can generate + can't you generate + ? And the Ajax function changes to *function addButtonCallback(myDate) { so that you can access to "2011-08-17" in your function. I don't know anything about the Ajax->web2py aspect, but the pure Ajax aspect, should work as it ;)

[web2py] migrate=True not creating table ?

2011-08-23 Thread TomPliss
Hey (noob here again), I needed to change the type of a field in my DB (the Date one of a table was a string, i'm changing its require to IS_DATE). but the values for existing entries were "wrong" (string has no attribute year), so went on "oh, only tests are in this table, let's drop it", and dr

[web2py] Re: migrate=True not creating table ?

2011-08-23 Thread TomPliss
tentially lost > data you have entered so, make sure you backup everything if important > before doing that. > > Richard > > > > > > > > On Tue, Aug 23, 2011 at 11:17 AM, TomPliss wrote: > > Hey (noob here again), > > > I needed to change the

[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
It's nearly working ! The table was dropped, I renamed the .table file, got migrate='tabename.table', saved model.py and restarted the server. I get this error : (near "IGNORE": syntax error) at the last field of the missing table line : Field('FIN_CO1', label='Documentations', writable=

[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
Getting the " ondelete='ignore' " away from the missing table declaration let web2py create it. The problem is I want the " ondelete='ignore' "to be here, so I'm putting it back. Another problem : The DATE field seems to cause errors, when trying to read it. I'm gettign an error : ('str' object

[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
thanks about the ondelete="NO ACTION", it's working ! actually, even ondelete="ignore" works, if it is added after the table is created (even if it is not in the book). I still have the DATE error, unfortunatly, and don't know if it is related to the table creation problem... On Aug 24, 9:51 am,

[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
Hum, actually, it's not working as I thought... I thought there was an value for the ondelete option that would force web2py to delete the reference when the referenced object is deleted, but not to delete de referencing object... from what I just read in the book, there isn't :( Anyway, the DATE

[web2py] Re: migrate=True not creating table ?

2011-08-24 Thread TomPliss
OK ... now, I feel silly ... On Aug 24, 10:30 am, annet wrote: > In your table definition the date field should be defined like this: > > Field('some_date',type='date') > > ... and the validator: > > db.table.some_date.requires=IS_DATE(str(T('%Y-%m-%d'))) > > Hope this helps you solve the problem

[web2py] DB - removing reference when deleting referenced object...

2011-08-24 Thread TomPliss
Hey guys (yeah, i'm still here), I'd like to know what is the best way to remove a DB reference when the referenced object is removed. Is it possible directly in the db.py ? Is it possible to do it without modifying every form.accept including a reference in the form ? PS: talking about removin