Merge branch 'release/2.0.13'

This commit is contained in:
Nathan Chapman 2022-11-08 18:05:36 -07:00
commit 83ff171986
5 changed files with 27 additions and 4 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 4.0.2 on 2022-11-09 00:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0010_alter_productvariant_sku'),
]
operations = [
migrations.AlterField(
model_name='productvariant',
name='image',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.productphoto'),
),
]

View File

@ -161,6 +161,7 @@ class ProductVariant(models.Model):
ProductPhoto,
on_delete=models.SET_NULL,
related_name='+',
blank=True,
null=True
)
name = models.CharField(max_length=255)

View File

@ -25,6 +25,7 @@ class ProductVariantUpdateForm(forms.ModelForm):
'weight',
'track_inventory',
'stock',
'sorting',
'image'
]

View File

@ -93,15 +93,17 @@ class CreateOrder(PayPalClient):
processed_items = [
{
# Shows within upper-right dropdown during payment approval
"name": str(item["variant"]),
"name": f"{item['variant']} " + "; ".join(
f"{key}: {value}" for key, value in item["options"].items()
),
# Item details will also be in the completed paypal.com
# transaction view
"description": item["variant"].product.subtitle,
"unit_amount": {
"currency_code": settings.DEFAULT_CURRENCY,
"value": f'{item["variant"].price}',
"value": f"{item['variant'].price}",
},
"quantity": f'{item["quantity"]}',
"quantity": f"{item['quantity']}",
}
for item in params["items"]
]

View File

@ -216,7 +216,7 @@ class ProductDetailView(FormMixin, DetailView):
track_inventory=True,
stock__gt=0
)
).order_by('name')
).order_by('sorting', 'name')
options = ProductOption.objects.filter(products__pk=self.object.pk)
if form_class is None:
form_class = self.get_form_class()