Hi All,

I am trying to learn web2py by implementing the nerddinner example from
ASP.NET MVC.

The following is the corresponding code in the model:

db.define_table('dinners',
    Field('title','string',length=50,required=True,notnull=True),

Field('eventdate','datetime',required=True,notnull=True,requires=IS_DATETIME()),

Field('description','text',required=True,notnull=True,requires=[IS_LENGTH(256),IS_NOT_EMPTY()]),

Field('hostedby','string',length=20,required=True,notnull=True,requires=IS_NOT_EMPTY()),

Field('contactphone','string',length=20,required=True,notnull=True,requires=IS_NOT_EMPTY()),

Field('address','string',length=256,required=True,notnull=True,requires=IS_NOT_EMPTY()),

Field('country','string',length=20,required=True,notnull=True,requires=IS_NOT_EMPTY()),

Field('latitude','double',required=True,notnull=True,requires=IS_NOT_EMPTY()),

Field('longitude','double',required=True,notnull=True,requires=IS_NOT_EMPTY()),
    format='%(title)s'
    )
db.dinners.title.requires =
[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,db.dinners.title)]

db.define_table('rsvp',
    Field('dinnerid',db.dinners),

Field('attendeename','string',length=30,required=True,notnull=True,requires=IS_NOT_EMPTY())
    )
db.rsvp.dinnerid.requires = IS_IN_DB(db,db.dinners.id,'%(title)s')
db.rsvp.dinnerid.notnull = True

When I check in the database, I see that in the table 'rsvp', the field
'dinnerid' is a nullable column (though I specifically set it to notnull in
the model code). I verified the behavior in both MSSQL Server and MySQL.

Can you please clarify if this is a bug or a default behavior. If it is the
default behavior, why?

Thanks,
rAm

i Think, i Wait, i Fast -- Siddhartha
http://sodidi.ramjeeganti.com

Reply via email to