(apps, schema_editor)
Updating Layer 'ows_url' if referencing an INDEXED Remote Service
Updating Layer 'ows_url' if referencing an INDEXED Remote Service
Updating Layer ows_url if referencing an INDEXED Remote Service
def update_ows_url(apps, schema_editor):
    """Updating Layer 'ows_url' if referencing an INDEXED Remote Service
    """
    MyModel = apps.get_model('layers', 'Dataset')
    FkModel = apps.get_model('services', 'Service')

    def _lambda(x): return x[1] if not x[2] else urljoin(settings.SITEURL, reverse('service_proxy', args=[x[0]]))

    for _m in MyModel.objects.filter(models.Q(remote_service__isnull=False) & models.Q(remote_service__method=INDEXED)):
        service_url_query = FkModel.objects.filter(pk=_m.remote_service).values_list('id', 'base_url', 'proxy_base')[:1]
        MyModel.objects.filter(pk=_m).update(
            ows_url=_lambda(list(service_url_query)[0])
        )
def update_ows_url ( apps , schema_editor ) : MyModel = apps . get_model ( 'layers' , 'Dataset' ) FkModel = apps . get_model ( 'services' , 'Service' ) def _lambda ( x ) : return x [ 1 ] if not x [ 2 ] else urljoin ( settings . SITEURL , reverse ( 'service_proxy' , args = [ x [ 0 ] ] ) ) for _m in MyModel . objects . filter ( models . Q ( remote_service__isnull = False ) & models . Q ( remote_service__method = INDEXED ) ) : service_url_query = FkModel . objects . filter ( pk = _m . remote_service ) . values_list ( 'id' , 'base_url' , 'proxy_base' ) [ : 1 ] MyModel . objects . filter ( pk = _m ) . update ( ows_url = _lambda ( list ( service_url_query ) [ 0 ] ) )