On Apr 6, 11:01 am, annet <jmverm...@xs4all.nl> wrote:
> I have got the following model:
>
> db.define_table('postcoderegio',
>     SQLField('regio', type='integer', length=2, default='',
> notnull=True),

length is not valid with integer fields

>     SQLField('min', type='integer', length=4, default='',
> notnull=True),
>     SQLField('max', type='integer', length=4, default='',
> notnull=True),
>     SQLField('provincie', db.provincie, default='', notnull=True,
> ondelete='RESTRICT'),
>     migrate=False)
>
> db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(00,99),IS_LENGTH(2),
> IS_NOT_EMPTY()]

same here, IS_LENGTH is invalid with integers (numbers don't have a
length property in Python).

> db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(0000,9999), IS_LENGTH
> (4), IS_NOT_EMPTY()]

you probably mean db.postcoderegio.min ...

> db.postcoderegio.regio.requires=[IS_INT_IN_RANGE(0000,9999), IS_LENGTH
> (4), IS_NOT_EMPTY()]

... and db.postcoderegio.max
(an example of copy/paste/forget-to-fix, it happens to me too)

> db.postcoderegio.provincie.requires=IS_IN_DB(db, db.provincie.id, '%
> (provincie)s')
>
> When I try to insert a record using the appadmin interface I get an
> error on the regio field. The error message reads: not unicode.
>
> How do I solve this problem? And what is it's cause?
>
> Kind regards,
>
> Annet.

I don't know how postal codes look like over there but Massimo's
suggestion only works if they are exactly 4 digits long and if they
are strings, otherwise you will get the same "Not Unicode" error.


--~--~---------~--~----~------------~-------~--~----~
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