You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/06/01 09:09:40 UTC

[GitHub] [incubator-superset] zufolo441 edited a comment on issue #9949: jinja templating in markdown element

zufolo441 edited a comment on issue #9949:
URL: https://github.com/apache/incubator-superset/issues/9949#issuecomment-636719903


   I tried to apply process_template() to iframe viz.
   I'm trying to call another chart with parameters in json data in url, for example 
   %22select_country%22%3A%22{{url_param('cartina',default='Toscana_province_2020')}}%22
   in place of original
   %22select_country%22%3A%22Toscana_province_2020%22
   
   I tried to edit get_data() in this way:
   class IFrameViz(BaseViz):
   
       """You can squeeze just about anything in this iFrame component"""
   
       viz_type = "iframe"
       verbose_name = _("iFrame")
       credits = 'a <a href="https://github.com/airbnb/superset">Superset</a> original'
       is_timeseries = False
       def query_obj(self):
           return None
   
       def get_df(self, query_obj: Optional[Dict[str, Any]] = None) -> pd.DataFrame:
           return pd.DataFrame()
   
       def get_data(self, df: pd.DataFrame) -> VizData:
           template_processor = get_template_processor(self.datasource.database)
           self.form_data['url']=template_processor.process_template(self.form_data['url'])
           return {"iframe": True }
   
   If I look at json I see "url" field with parameters replaced by correct values, but url called by browser in order to fill page has parameters replaced by anything.
   example: I iframe URL I put ....&height={{url_param('altezza',default=300)}}
   in json I see ...&height=300
   but page has been called with ...&height=
   
   Can anyone help me ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org