Ejemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop("request")
        self.shop = get_shop(self.request)
        super(DiscountForm, self).__init__(*args, **kwargs)

        self.fields["availability_exceptions"].queryset = AvailabilityException.objects.filter(shops=self.shop)
        self.fields["category"].queryset = Category.objects.filter(shops=self.shop)
        self.fields["contact"].widget = ContactChoiceWidget(clearable=True)
        self.fields["contact_group"].queryset = ContactGroup.objects.filter(shop=self.shop)
        self.fields["coupon_code"].queryset = CouponCode.objects.filter(shops=self.shop)
        self.fields["happy_hours"].queryset = HappyHour.objects.filter(shops=self.shop)
        self.fields["product"].widget = ProductChoiceWidget(clearable=True)
        self.fields["supplier"].queryset = Supplier.objects.enabled(shop=self.shop)
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop("request")
        self.shop = get_shop(self.request)
        super(DiscountForm, self).__init__(*args, **kwargs)

        self.fields["category"].queryset = Category.objects.filter(
            shops=self.shop)
        self.fields["contact"].widget = ContactChoiceWidget(clearable=True)
        self.fields["contact_group"].queryset = ContactGroup.objects.filter(
            Q(shop=self.shop) | Q(shop__isnull=True))
        self.fields["happy_hours"].queryset = HappyHour.objects.filter(
            shop=self.shop)
        self.fields["product"].widget = ProductChoiceWidget(clearable=True)
        self.fields["supplier"].queryset = Supplier.objects.enabled(
            shop=self.shop)
Ejemplo n.º 3
0
class ContactGroupMembersForm(forms.Form):
    member = forms.ModelChoiceField(queryset=Contact.objects.all(),
                                    widget=ContactChoiceWidget(empty_text=""),
                                    label=_('member'))