~michael-howden/sahana-eden/adpc

« back to all changes in this revision

Viewing changes to controllers/gis.py

  • Committer: Michael Howden
  • Date: 2011-04-04 10:39:31 UTC
  • Revision ID: michael@sahanafoundation.org-20110404103931-uwlc539ogujo2o6b
* Disabling feature_class_id field to prevent the addition of new countries
* Show location list to allow editting of locations

Show diffs side-by-side

added added

removed removed

Lines of Context:
417
417
        #filters.append((db.gis_location.id == db.gis_location_to_feature_group.location_id) &
418
418
        #    (db.gis_location_to_feature_group.feature_group_id == db.gis_feature_group.id) & (db.gis_feature_group.name.like(fgroup)))
419
419
 
420
 
    parent = _vars.get("parent", None)
421
 
    if parent:
 
420
    #Removed for DRRPP to allow edit of locations
 
421
    #parent = _vars.get("parent", None)
 
422
    #if parent:
422
423
        # Can't do this using a JOIN in DAL syntax
423
424
        # .belongs() not GAE-compatible!
424
 
        filters.append((db.gis_location.parent.belongs(db(db.gis_location.name.like(parent)).select(db.gis_location.id))))
 
425
        #filters.append((db.gis_location.parent.belongs(db(db.gis_location.name.like(parent)).select(db.gis_location.id))))
425
426
        # ToDo: Make this recursive - want ancestor not just direct parent!
 
427
        
 
428
    # Prevent the addition of countries
 
429
    table.feature_class_id.readable = table.feature_class_id.writable = False
426
430
 
427
431
    caller = _vars.get("caller", None)
428
432
    if caller:
478
482
    if filters:
479
483
        response.s3.filter = reduce(__and__, filters)
480
484
 
481
 
    response.s3.pagination = True
 
485
    #response.s3.pagination = True
482
486
 
483
487
    # Post-processor
484
488
    def user_postp(jr, output):
486
490
        return output
487
491
    response.s3.postp = user_postp
488
492
 
489
 
    output = shn_rest_controller(module, resource)
 
493
    output = shn_rest_controller(module, resource,
 
494
                                 listadd=False,)
490
495
 
491
496
    if isinstance(output, dict):
492
497
        output.update(gis_location_hierarchy=gis_location_hierarchy)