Can a reference be optional?

On Monday, February 18, 2013 12:19:04 AM UTC-8, Paul Whipp wrote:
>
> Here is an example of what I need to do:
>
> db.define_table('Docket',
>         Field('Docket_No', 'integer',
>             required = True),
>         Field('Reference_Docket_ID', 'reference Docket',
>             required = False),
>         Field('Reference_Docket_No', 'integer',
>             required = False),
> ...
>
> The docket optionally refers to a preceding docket in the model. It 
> appears that web2py's DAL ignores the required = False specification for 
> this field because when I use the SQLFORM it tells me that 'Reference 
> Docket_ID' is a required field so its impossible to enter any docket 
> records.
>
> The client database is postgresSQL
>
> I tried adding the field constraints (e.g. db.Docket.Docket_No.requires = 
> IS_NULL_OR(IS_IN_DB(...))) 
> but then it fails to display the dropdown when the form is presented.
>
> With hundreds of tables, I don't want to have to craft the form by hand.
>
> I'm also wondering what happens when there are many thousands of dockets - 
> will the dropdown for the Reference_Docket_ID on the form cope effectively?
>
> Cheers,
> Paul
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to