If you want you can send me the entire code privately. Massimo
On Nov 18, 3:46 am, pigmej <[EMAIL PROTECTED]> wrote: > Massimo, > > That's part of my model, all tables are difined. And works everything > except this one relation. > > No idea why it does not work. > > On Nov 18, 5:01 am, mdipierro <[EMAIL PROTECTED]> wrote: > > > I rearranged the order of you code and removed those cols referencing > > tables that are not defined. The following code works: > > > import datetime > > now=datetime.datetime.today() > > > db=SQLDB('sqlite://storage.db') > > > db.define_table('docs_categories', > > SQLField('name','string',length=150), > > SQLField('url','string',length=60), > > SQLField('descr','text'), > > SQLField('short','string',length=150), > > SQLField('created','datetime',default=now), > > ) > > > db.define_table('docs_pages_ver', > > SQLField('content','text'), > > SQLField('created','datetime',default=now), > > SQLField('order_in','integer', default=1), > > SQLField('category',db.docs_categories), > > SQLField('svn','integer'), > > SQLField('descr','text') > > ) > > > #docs_pages_ver > > db.docs_pages_ver.category.requires=IS_NULL_OR(IS_IN_DB > > (db,'docs_categories.id','docs_categories.name',error_message="Błąd > > synchronizacji")) > > db.docs_pages_ver.content.requires=IS_NOT_EMPTY(error_message="Należy > > wypełnić") > > db.docs_pages_ver.created.requires=IS_DATETIME(error_message="To musi > > być data") > > db.docs_pages_ver.order_in.requires=IS_NULL_OR(IS_INT_IN_RANGE > > (1,99,error_message="Musi być liczbą między 1 a 99")) > > db.docs_pages_ver.svn.requires=IS_NULL_OR(IS_INT_IN_RANGE > > (1,10000,error_message="To musi być liczba")) > > > #docs_categories > > db.docs_categories.name.requires=IS_NOT_IN_DB > > (db,'docs_categories.name',error_message="Taka wartość już istnieje w > > bazie") > > db.docs_categories.url.requires=IS_NOT_IN_DB > > (db,'docs_categories.url',error_message="Taka wartość już istnieje w > > bazie") > > db.docs_categories.descr.requires=IS_NOT_EMPTY(error_message="Należy > > wypełnić") > > db.docs_categories.short.requires=IS_NOT_EMPTY(error_message="Należy > > wypełnić") > > db.docs_categories.created.requires=IS_DATETIME(error_message="To musi > > być data") > > > On Nov 17, 8:40 pm, mdipierro <[EMAIL PROTECTED]> wrote: > > > > I will give this a try later tonight. > > > > Massimo > > > > On Nov 17, 5:59 pm, pigmej <[EMAIL PROTECTED]> wrote: > > > > > Yarko it's after :) > > > > > I copied parts from it and paste there. So thats not that problem ;) > > > > > On Nov 18, 12:55 am, "Yarko Tymciurak" <[EMAIL PROTECTED]> wrote: > > > > > > OH! > > > > > You need to realize one thing: web2py EXECUTES your models - > > > > > > db.docs_categories.name.requires.... > > > > > > must appear AFTER the db.define_table which defines > > > > > docs_categories.... > > > > > > Try to arrange your code to account for this - then see what you get. > > > > > > On Mon, Nov 17, 2008 at 5:39 PM, pigmej <[EMAIL PROTECTED]> wrote: > > > > > > > so.... > > > > > > > Any single error. Just nothing select in Category dropdown if I > > > > > > generate SQLFORM(db.docs_pages_ver,values,showid = False). All other > > > > > > dropdown's are selected ( author and parrent ) but not this one.... > > > > > > > Part of model (it's enough?): > > > > > >http://wklej.to/bpL170 > > > > > > > On Nov 18, 12:28 am, mdipierro <[EMAIL PROTECTED]> wrote: > > > > > > > what error do you get? can I see the model? > > > > > > > > On Nov 17, 4:00 pm, pigmej <[EMAIL PROTECTED]> wrote: > > > > > > > > > Did not works. > > > > > > > > > On Nov 17, 10:26 pm, mdipierro <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Do not know whitout lookig at models but try replace > > > > > > > > > > db.docs_pages_ver.category.requires=IS_NULL_OR(IS_IN_DB > > > > > > > > > (db,'docs_categories.id','docs_categories.name > > > > > > ',error_message="...")) > > > > > > > > > > with > > > > > > > > > > db.docs_pages_ver.category.requires=IS_NULL_OR(IS_IN_DB > > > > > > > > > (db,'docs_categories.id','%(id)s',error_message="...")) > > > > > > > > > > then try replace %(id)s with %(name)s > > > > > > > > > > On Nov 17, 3:14 pm, pigmej <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > Controler: > > > > > > > > > > > def test(): > > > > > > > > > > values=db(db.docs_pages_ver.id==47).select()[0] > > > > > > > > > > return SQLFORM(db.docs_pages_ver,values,showid = False) > > > > > > > > > > > model: > > > > > > > > > > db.docs_pages_ver.category.requires=IS_NULL_OR(IS_IN_DB > > > > > > > > > > (db,'docs_categories.id','docs_categories.name > > > > > > ',error_message="...")) > > > > > > > > > > db.docs_pages_ver.author.requires=IS_IN_DB > > > > > > > > > > (db,'users.id','users.nick',error_message="...") > > > > > > > > > > db.docs_pages_ver.parrent.requires=IS_NULL_OR(IS_IN_DB > > > > > > > > > > (db,'docs_pages.id','docs_pages.title',error_message="...")) > > > > > > > > > > ... > > > > > > > > > > > And in output everything is ok except category field. All > > > > > > > > > > fields > > > > > > are > > > > > > > > > > selected correctly, except this one. > > > > > > > > > > In category field there is nothing selected. There are the > > > > > > > > > > same > > > > > > kind > > > > > > > > > > of relations etc. > > > > > > > > > > > I have no idea what's wrong > > > > > > > > > > > Btw. > > > > > > > > > > > return values.category returns an correct integer ( it > > > > > > > > > > exists in > > > > > > > > > > db.category.id ) > > > > > > > > > > > Any ideas ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---