That makes sense- thank you

On Saturday, May 12, 2012 6:57:59 PM UTC-4, Anthony wrote:
>
> From the book:
>
> default sets the default value for the field. The default value is used 
> when performing an insert if a value is not explicitly specified.
>
> required tells the DAL that no insert should be allowed on this table if 
> a value for this field is not explicitly specified.
>
>
> required=True means a value must be explicitly specified -- defaults 
> don't count. Anyway, if you're specifying a default, there should be no 
> reason to set required=True. Note, the required attribute is enforced by 
> the DAL -- if you want the database itself to require a value for all 
> inserts, then set notnull=True. Again, from the book:
>
> Notice that requires=... is enforced at the level of forms, required=True is 
> enforced at the level of the DAL (insert), while notnull, unique and 
> ondelete are enforced at the level of the database. While they sometimes 
> may seem redundant, it is important to maintain the distinction when 
> programming with the DAL.
>
>
> Anthony
>
> On Saturday, May 12, 2012 6:18:03 PM UTC-4, Yarin wrote:
>>
>>
>> I've got a table with the following field defined:
>> Field('archived', 'boolean',default=False, required=True),
>>
>> and yet, I'm getting the following error on insert:
>>
>> <type 'exceptions.SyntaxError'> Table: missing required field: archived
>> How could this be? The table has a default specified?
>>
>

Reply via email to