小编Jay*_*ari的帖子

如何从视图中将值传递给 Django Form 的 init 方法?

表格.py

class AddDuration(forms.Form):

    def __init__(self, *args, **kwargs): 
        super(AddDuration, self).__init__(*args, **kwargs)
        // set value to relates_to_choices
        relates_to_choices = ????????????? // Something like self.choices
        self.fields['duration'].choices = relates_to_choices

    duration = forms.ChoiceField(required=True)
Run Code Online (Sandbox Code Playgroud)

现在,我有一个包含类的 views.py 文件

class AddDurationView(FormView):
    template_name = 'physician/add_duration.html'
    form_class = AddDurationForm
Run Code Online (Sandbox Code Playgroud)

forms django views init choicefield

5
推荐指数
1
解决办法
3395
查看次数

Tableau Javascript API HTTPS无法正常工作

我试图在我的网站上嵌入一个报告,但收到以下错误

混合内容:" https://mywebsite.com/blah/blah " 页面是通过HTTPS加载的,但请求了一个不安全的资源" http://my-tableau-report-location.com/dashboard ".此请求已被阻止; 内容必须通过HTTPS提供.

但是在我的JS API调用中,我有"HTTPS://"的网址,即" https://my-tableau-report-location.com/dashboard "

我是否需要添加API选项才能使其成为HTTPS?我错过了什么?

javascript api report tableau-api

5
推荐指数
1
解决办法
787
查看次数

标签 统计

api ×1

choicefield ×1

django ×1

forms ×1

init ×1

javascript ×1

report ×1

tableau-api ×1

views ×1