Beispiel #1
0
    def __init__(self, request, *args, **kwargs):
        super(SelectNodeGroupSharesAction,
              self).__init__(request, *args, **kwargs)

        possible_shares = self.get_possible_shares(request)

        self.fields["shares"] = workflow_helpers.MultipleShareChoiceField(
            label=_("Select Shares"),
            widget=workflow_helpers.ShareWidget(choices=possible_shares),
            required=False,
            choices=possible_shares)
Beispiel #2
0
    def __init__(self, request, *args, **kwargs):
        super(SelectSharesAction, self).__init__(request, *args, **kwargs)

        possible_shares = self.get_possible_shares(request)

        cluster_id = [x["cluster_id"] for x in args if "cluster_id" in x][0]
        self.fields["cluster_id"] = forms.CharField(widget=forms.HiddenInput(),
                                                    initial=cluster_id)

        self.fields["shares"] = whelpers.MultipleShareChoiceField(
            label=_("Select Shares"),
            widget=whelpers.ShareWidget(choices=possible_shares),
            required=False,
            choices=possible_shares,
        )

        cluster = [x["cluster"] for x in args if "cluster" in x][0]
        self.fields["shares"].initial = (self._get_share_defaults(
            cluster.shares, self.fields["shares"]))