In my model I have the following table:

db.define_table('adres',
    db.Field('bedrijf',db.bedrijf,label='Bedrijf *
',default='',notnull=True),
    db.Field('adressoort',label='Adressoort *
',length=30,default='',notnull=True),
    db.Field(...),
    migrate=False)

db.adres.bedrijf.requires=[IS_IN_DB(db,db.bedrijf.id,'%(bedrijfsnaam)
s'),IS_NOT_IN_DB(db
(db.adres.adressoort==request.vars.adressoort),'adres.bedrijf')]
db.adres.adressoort.requires=IS_IN_SET(['Statutair
vestigingsadres','Vestigingsadres','Postadres'])


The IS_NOT_IN_DB() validator works fine in appadmin, but doesn't work
in my custom crud_address method:


@auth.requires_membership('core_manager')
def crud_address():
    db.adres.bedrijf.writable=False
    db.adres.bedrijf.default=auth.user.bedrijf
    form=crud.create(db.adres)
    form[0][-1][1].append(INPUT(_type='reset',_value='Reset'))
    records=db(db.adres.bedrijf==auth.user.bedrijf).select
(db.adres.ALL,orderby=db.adres.adressoort)
    return dict(form=form,records=records)


I guess it has something to do with setting
db.adres.bedrijf.writable=False. Is there a way to solve this problem.
The user should not be able to insert more than one, e.g, shipping
address.


Annet.




--~--~---------~--~----~------------~-------~--~----~
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 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to