Merge branch 'release/3.0.16'
This commit is contained in:
commit
c24ce1d9a0
@ -37,6 +37,13 @@ class ProductVariantUpdateForm(forms.ModelForm):
|
|||||||
product=self.instance.product
|
product=self.instance.product
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def clean_weight(self):
|
||||||
|
data = self.cleaned_data['weight']
|
||||||
|
if not data:
|
||||||
|
data = 0
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
class CouponForm(forms.ModelForm):
|
class CouponForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@ -853,12 +853,26 @@ article + article {
|
|||||||
border-color: var(--yellow-color);
|
border-color: var(--yellow-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.product__form input,
|
.product__form input:not([type=radio]),
|
||||||
.product__form select {
|
.product__form select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.product__form #id_variant {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.product__form #id_variant div label {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@media screen and (max-width: 700px) {
|
@media screen and (max-width: 700px) {
|
||||||
.product__detail {
|
.product__detail {
|
||||||
|
|||||||
@ -17,15 +17,21 @@ from core import CoffeeGrind, ShippingContainer
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class VariantChoiceField(forms.ModelChoiceField):
|
||||||
|
def label_from_instance(self, obj):
|
||||||
|
return f'{obj.name} | ${obj.price}'
|
||||||
|
|
||||||
|
|
||||||
class AddToCartForm(forms.Form):
|
class AddToCartForm(forms.Form):
|
||||||
quantity = forms.IntegerField(min_value=1, max_value=20, initial=1)
|
quantity = forms.IntegerField(min_value=1, max_value=20, initial=1)
|
||||||
|
|
||||||
def __init__(self, variants, options, *args, **kwargs):
|
def __init__(self, variants, options, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.fields['variant'] = forms.ChoiceField(
|
self.fields['variant'] = VariantChoiceField(
|
||||||
label='',
|
queryset=variants,
|
||||||
choices=[(variant.pk, f'{variant.name} | ${variant.price}') for variant in variants]
|
widget=forms.RadioSelect,
|
||||||
|
label=''
|
||||||
)
|
)
|
||||||
|
|
||||||
for option in options:
|
for option in options:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user