def geoserver_post_save_map(instance, sender, created, **kwargs): instance.set_missing_info() if not created: if not instance.thumbnail_url or \ instance.thumbnail_url == static(settings.MISSING_THUMBNAIL): logger.debug(f"... Creating Thumbnail for Map [{instance.title}]") geoserver_create_thumbnail.apply_async((instance.id, False, True, ))
def geoserver_post_save_thumbnail(sender, instance, **kwargs): # Creating Layer Thumbnail # some thumbnail generators will update thumbnail_url. If so, don't # immediately re-generate the thumbnail here. use layer#save(update_fields=['thumbnail_url']) try: instance.refresh_from_db() logger.debug(f"... Creating Thumbnail for Layer {instance.title}") _recreate_thumbnail = False if 'update_fields' in kwargs and kwargs['update_fields'] is not None and \ 'thumbnail_url' in kwargs['update_fields']: _recreate_thumbnail = True if not instance.thumbnail_url or \ instance.thumbnail_url == staticfiles.static(settings.MISSING_THUMBNAIL) or \ is_monochromatic_image(instance.thumbnail_url): _recreate_thumbnail = True if _recreate_thumbnail: geoserver_create_thumbnail.apply_async((( instance.id, False, True, ))) else: logger.debug( f"... Thumbnail for Layer {instance.title} already exists: {instance.thumbnail_url}" ) except Exception as e: logger.exception(e)
def geoserver_post_save_map(instance, sender, created, **kwargs): instance.set_missing_info() if not created: if not instance.thumbnail_url or \ instance.thumbnail_url == static(MISSING_THUMB): logger.debug(f"... Creating Thumbnail for Map [{instance.title}]") # create_gs_thumbnail(instance, overwrite=False, check_bbox=True) geoserver_create_thumbnail.apply_async(( instance.id, False, True, ))