Massimo,

In db.py I have:

db.define_table('adres',
    db.Field('bedrijf',db.bedrijf,label='Bedrijf *
',default='',notnull=True,ondelete='CASCADE'),
    db.Field('adressoort',db.adressoort,label='Adressoort *
',default='',notnull=True,ondelete='RESTRICT'),
    db.Field('straat',label='Straat *
',length=42,default='',notnull=True),
    db.Field('huisnummer',label='Huisnummer *
',length=6,default='',notnull=True),
    db.Field('huisnummerextensie',length=6),
    db.Field('postcode_cijferdeel',type='integer',label='Postcode
cijferdeel',),
    db.Field('postcode_letterdeel',label='Postcode letterdeel'),
    db.Field('plaats',label='Plaats *
',length=42,default='',notnull=True),
    db.Field('created_on',type='datetime'),
    db.Field('modified_on',type='datetime'),
    migrate=False)


db.adres.bedrijf.requires=IS_IN_DB(db,db.bedrijf.id,'%(bedrijfsnaam)
s')
db.adres.adressoort.requires=IS_IN_DB(db,db.adressoort.id,'%(soort)
s',orderby=db.adressoort.id)
db.adres.straat.requires=[IS_LENGTH(42,error_message=T('length exceeds
42')),IS_NOT_EMPTY()]
db.adres.huisnummer.requires=[IS_LENGTH(6,error_message=T('length
exceeds 6')),IS_NOT_EMPTY()]
db.adres.huisnummerextensie.requires=IS_LENGTH(6,error_message=T
('length exceeds 6'))
db.adres.postcode_cijferdeel.requires=IS_NULL_OR(IS_MATCH('\d
{4}',error_message=T('no match 4 digits')))
db.adres.postcode_cijferdeel.comment=SPAN('Format:
1000/9999',_class='comment')
db.adres.postcode_letterdeel.requires=IS_NULL_OR(IS_MATCH('[A-Z]
{2}',error_message=T('no match 2 capitals')))
db.adres.postcode_letterdeel.comment=SPAN('Format: AA/
ZZ',_class='comment')
db.adres.plaats.requires=[IS_IN_DB(db,db.plaats.plaats,'%(plaats)s')]
db.adres.plaats.widget=lambda self,value:INPUT
(_type='text',_id='place',_class='ac_input',_name='plaats',value=str
(value),requires=self.requires)
db.adres.created_on.default=request.now
db.adres.created_on.readable=False
db.adres.created_on.writable=False
db.adres.modified_on.default=request.now
db.adres.modified_on.update=request.now
db.adres.modified_on.readable=False
db.adres.modified_on.writable=False


.., in the controller the functions:


@auth.requires_membership('core_manager')
def crud_address():
    response.functionname= T('CRUD adres')
    response.flash=T('create new record')
    response.flash_records= T('records in database')
    response.flash_no_records= T('no records')
    db.adres.bedrijf.writable=False
    db.adres.bedrijf.default=auth.user.bedrijf
    form=crud.create(db.adres)
    form[0][-1][1].append(INPUT(_type='reset',_value='Reset'))
    form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick="window.location='%s';"%URL
(r=request,f='index')))
    records=db(db.adres.bedrijf==auth.user.bedrijf).select
(db.adres.ALL,orderby=db.adres.adressoort)
    return dict(form=form,records=records)


@auth.requires_membership('core_manager')
def update_address():
    response.view='core/update.html'
    response.flash=T('update or delete record')
    db.adres.bedrijf.writable=False
    record=db.adres[request.args[0]]
    if not record or not record.bedrijf==auth.user.bedrijf:
        redirect(URL(r=request,f='crud_address'))
    form=crud.update(db.adres,request.args[0],next=(URL
(r=request,f='crud_address')))
    form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick='javascript:history.go
(-1)'))
    return dict(form=form)


..., and two views the crud_address one and a generic on for
update_address:

{{extend 'cmslayout.html'}}

<div id="primarycolumn">
  <div id="primarycontent">
    <div class="flash">
      {{=response.flash}}
    </div> <!-- flash -->
    {{=form}}
    <div id="dt_cms">
      {{if not records:}}
        <div class="flash_records">
          {{=response.flash_no_records}}
        </div> <!-- flash_records -->
      {{else:}}
        <div class="flash_records">
          {{=response.flash_records}}
        </div> <!-- flash_records -->
        <table id="cms" class="display">
          <thead>
            <tr>
              <th>straat</th>
              <th>huisnummer</th>
              <th>plaats</th>
              <th>crud record</th>
            </tr>
          </thead>
          <tbody>
            {{for record in records:}}
              <tr>
                <td>
                  {{=record.straat}}
                </td>
                <td>
                  {{=record.huisnummer}}
{{=record.huisnummerextensie}}
                <td>
                  {{=record.plaats}}
                </td>
                <td>
                  {{=A(T('update/delete'),_href=URL
(r=request,f='update_address',args=[record.id]))}}
                </td>
              </tr>
            {{pass}}
          </tbody>
        </table>
      {{pass}}
    </div> <!-- dt_cms -->
  </div> <!-- primarycontent -->
</div> <!-- primarycolumn -->
<div id="secondarycolumn">
  {{include 'cms_navigation.html'}}
</div> <!-- secondarycolumn -->


<div id="primarycolumn">
  <div id="primarycontent">
    <div class="flash">
      {{=response.flash}}
    </div> <!-- flash -->
    {{=form}}
  </div> <!-- primarycontent -->
</div> <!-- primarycolumn -->
<div id="secondarycolumn">
  {{include 'cms_navigation.html'}}
</div> <!-- secondarycolumn -->


As I said, in version 1.61.4 this worked, I tested it again yesterday,
and it still does work , only in version 1.63.5 it breaks.


Kind 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