In my model I have got the following table definitions:

db.define_table('organisatie',
    SQLField('organisatienaam'),
    migrate='organisatie.table')

db.organisatie.organisatienaam.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'organisatie.organisatienaam')]


db.define_table('tag',
    SQLField('tag_name'),
    migrate='tag.table')

db.tag.tag_name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'tag.tag_name')]


db.define_table('color',
    SQLField('hex_code'),
    SQLField('color_name'),
    migrate='color.table')

db.color.hex_code.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'color.hex_code')]
db.color.color_name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB
(db,'color.color_name')]


db.define_table('organisatietag',
    SQLField('mutatiedatum','date'),
    SQLField('organisatie',db.organisatie),
    SQLField('tag'),
    #SQLField('mcuc_org_tag'),
    SQLField('bg_color'),
    SQLField('color'),
    SQLField('font'),
    SQLField('text_align'),
    migrate='organisatietag.table')

db.organisatietag.organisatie.requires=IS_IN_DB(db,db.organisatie.id,'%
(organisatienaam)s')
db.organisatietag.tag.requires=IS_IN_DB(db,db.tag.tag_name,'%(tag_name)
s')
#db.organisatietag.mcuc_org_tag.requires=IS_NOT_EMPTY()
db.organisatietag.bg_color.requires=IS_IN_DB(db,db.color.hex_code,'%
(color_name)s')
db.organisatietag.color.requires=IS_IN_DB(db,db.color.hex_code,'%
(color_name)s')
db.organisatietag.font.requires=IS_IN_SET(['Arial','Comic
Sans','Courier','Geneva','Georgia','Impact','Times New
Roman','Verdana'])
db.organisatietag.text_align.requires=IS_IN_SET
(['left','center','right'])


Furthermore, I have got a function which reads like:

import datetime

now=datetime.datetime.today()
today=datetime.date.today()


def index():
    form=SQLFORM(db.organisatie)
    if form.accepts(request.vars,session):
        tags=db().select(db.tag.ALL,orderby=db.tag.tag_name)
        for tag in tags:
            db.organisatietag.insert(mutatiedatum=today,\
            organisatie=form.vars.id, tag=tag,bg_color='#C0C0C0',\
            color='#000000',font='Verdana',text_align='center')
        response.flash='form accepted'
    return dict(form=form)


I had hoped that when the user insert an organization, this code would
insert as many records into the organisatietag table as there are
records in the tag table. However, it neither inserts the organization
nor does it insert any records into the organisatietag table.

The problem is it doesn't report any errors either, so I haven't got a
clue why, this code doesn't work. Does one of you know why this
doesn't work?


Best regards,

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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to