apotterri/django-oscar huggingface dataset:
Repository: django-oscar/django-oscar

Issue:
The postal Code validation for Israel should also take 5 digit numbers
In oscar.apps.address.abstract_models.AbstractAddress:

`'IL': r'^[0-9]{7}$',`

Should be:
`'IL': r'^([0-9]{5}|[0-9]{7})$',`

For more info: https://en.wikipedia.org/wiki/Postal_codes_in_Israel


Discussion:
Right, but seems 5-digit postal codes are not officially used any more, could you please mention working 5-digit postal code?
But they are used by our customers. So sure I can just overwrite it, which we have. 

To me the key sentence in the wiki article is: "they continue to be widely used". As we are dealing with people and not machines, then what is official is to me not as important as what is used by our customers :)
@ckaalund grateful if you can make a PR to address this.
Or if you could quote working 5-digit postal code - that also would be helpful.
Ok, found reference by myself of https://en.youbianku.com/Israel.

PR is coming as well.


Fix patch:
diff --git a/src/oscar/apps/address/abstract_models.py b/src/oscar/apps/address/abstract_models.py
--- a/src/oscar/apps/address/abstract_models.py
+++ b/src/oscar/apps/address/abstract_models.py
@@ -103,7 +103,7 @@ class AbstractAddress(models.Model):
         'HT': r'^[0-9]{4}$',
         'HU': r'^[0-9]{4}$',
         'ID': r'^[0-9]{5}$',
-        'IL': r'^[0-9]{7}$',
+        'IL': r'^([0-9]{5}|[0-9]{7})$',
         'IM': r'^IM[0-9]{2,3}[A-Z]{2}$$',
         'IN': r'^[0-9]{6}$',
         'IO': r'^[A-Z]{4}[0-9][A-Z]{2}$',


Test patch:
diff --git a/tests/integration/address/test_models.py b/tests/integration/address/test_models.py
--- a/tests/integration/address/test_models.py
+++ b/tests/integration/address/test_models.py
@@ -225,6 +225,8 @@ def test_summary_is_property(self):
     ('BN', 'BC3615'),
     ('TW', '104'),
     ('TW', '10444'),
+    ('IL', '1029200'),
+    ('IL', '94142'),
     # It works for small cases as well
     ('GB', 'sw2 1rw'),
 ]
Repository: django-oscar/django-oscar

Issue:
product-lookup not working
### Issue Summary
Can't select related products

### Steps to Reproduce

1. run sandbox
2. in Dashboard->products select any product eg. The shellcoder's handbook
3. in product's upselling click text field `Recommended product:`
4. dropdown contains `The results could not be loaded.` and console throws ` Internal Server Error: /en-gb/dashboard/catalogue/product-lookup/`
with traceback ending
```
django-oscar/src/oscar/apps/dashboard/catalogue/views.py", line 649, in get_queryset
    return self.model.browsable.all()
AttributeError: type object 'Product' has no attribute 'browsable'
```

### Technical details

* Python version: 3.7.5
* Django version: 2.2.11
* Oscar version: commit  5de733e



Discussion:

Fix patch:
diff --git a/src/oscar/apps/dashboard/catalogue/views.py b/src/oscar/apps/dashboard/catalogue/views.py
--- a/src/oscar/apps/dashboard/catalogue/views.py
+++ b/src/oscar/apps/dashboard/catalogue/views.py
@@ -646,7 +646,7 @@ class ProductLookupView(ObjectLookupView):
     model = Product
 
     def get_queryset(self):
-        return self.model.browsable.all()
+        return self.model.objects.browsable().all()
 
     def lookup_filter(self, qs, term):
         return qs.filter(Q(title__icontains=term)


Test patch:
diff --git a/tests/functional/dashboard/test_catalogue.py b/tests/functional/dashboard/test_catalogue.py
--- a/tests/functional/dashboard/test_catalogue.py
+++ b/tests/functional/dashboard/test_catalogue.py
@@ -30,7 +30,8 @@ class TestCatalogueViews(WebTestCase):
     def test_exist(self):
         urls = [reverse('dashboard:catalogue-product-list'),
                 reverse('dashboard:catalogue-category-list'),
-                reverse('dashboard:stock-alert-list')]
+                reverse('dashboard:stock-alert-list'),
+                reverse('dashboard:catalogue-product-lookup')]
         for url in urls:
             self.assertIsOk(self.get(url))
Repository: django-oscar/django-oscar

Issue:
Setting `required` on a ProductAttribute with type boolean is non-sensical
### Issue Summary
When a `ProductAttribute` with type `boolean` is set to `required=True`, it requires any underlying`ProductAttributeValue` to be set to `True`, otherwise the Product you're trying to create/change won't save in the dashboard. I don't think the `required` field makes sense for a boolean field in this case. A Boolean field could still be `False` but be required to be filled in as `False`. It's all a bit confusing. 

It makes sense purely on a form, where you might need to check a checkbox to submit the form. But in this case it's a field in a database that's required. 

### Steps to Reproduce
1. Go to dashboard
1. On any `ProductType` defined, add an Attribute with type `True / False` and set the `Required` field to `True`.
1. Create a new product with this `ProductType` and set the attribute on the product to `False`

The dashboard interface says it's required to be set to `True` and as such the option for `False` is not possible.

### Proposed solution
Don't allow `ProductAttribute`'s with type `boolean` to be set to `required=True`.

### Technical details
I've tested this on an older Python version. But couldn't find any reference of a fix for this in the latest version.

* Python version: `2.7.17`
* Django version: `1.11.23`
* Oscar version: `1.6.7 `



Discussion:
Thanks for this - your proposed fix makes sense, PR welcome if you have time.

Fix patch:
diff --git a/src/oscar/apps/catalogue/abstract_models.py b/src/oscar/apps/catalogue/abstract_models.py
--- a/src/oscar/apps/catalogue/abstract_models.py
+++ b/src/oscar/apps/catalogue/abstract_models.py
@@ -851,6 +851,10 @@ def is_file(self):
     def __str__(self):
         return self.name
 
+    def clean(self):
+        if self.type == self.BOOLEAN and self.required:
+            raise ValidationError(_("Boolean attribute should not be required."))
+
     def _save_file(self, value_obj, value):
         # File fields in Django are treated differently, see
         # django.db.models.fields.FileField and method save_form_data


Test patch:
diff --git a/tests/integration/catalogue/test_models.py b/tests/integration/catalogue/test_models.py
--- a/tests/integration/catalogue/test_models.py
+++ b/tests/integration/catalogue/test_models.py
@@ -19,3 +19,9 @@ def test_product_attributes_cant_be_python_keywords():
     attr = models.ProductAttribute(name="A", code="import")
     with pytest.raises(ValidationError):
         attr.full_clean()
+
+
+def test_product_boolean_attribute_cant_be_required():
+    attr = models.ProductAttribute(name="A", code="a", type=models.ProductAttribute.BOOLEAN, required=True)
+    with pytest.raises(ValidationError):
+        attr.full_clean()
Repository: django-oscar/django-oscar

Issue:
is_public flag is not respected when listing child products
### Issue Summary

When rendering product variants (e.g., in the detail view for a parent product), Oscar does not check whether those variants are public. It uses `product.children.all`.

### Steps to Reproduce

1. Set `is_public=False` on a child product!
2. Notice that it is still listed in the parent product detail view.


Discussion:

Fix patch:
diff --git a/src/oscar/apps/basket/forms.py b/src/oscar/apps/basket/forms.py
--- a/src/oscar/apps/basket/forms.py
+++ b/src/oscar/apps/basket/forms.py
@@ -148,7 +148,7 @@ def _create_parent_product_fields(self, product):
         """
         choices = []
         disabled_values = []
-        for child in product.children.all():
+        for child in product.children.public():
             # Build a description of the child, including any pertinent
             # attributes
             attr_summary = child.attribute_summary
diff --git a/src/oscar/apps/catalogue/managers.py b/src/oscar/apps/catalogue/managers.py
--- a/src/oscar/apps/catalogue/managers.py
+++ b/src/oscar/apps/catalogue/managers.py
@@ -107,6 +107,12 @@ def browsable(self):
         """
         return self.filter(parent=None, is_public=True)
 
+    def public(self):
+        """
+        Excludes non-public products
+        """
+        return self.filter(is_public=True)
+
     def browsable_dashboard(self):
         """
         Products that should be browsable in the dashboard.
diff --git a/src/oscar/apps/partner/strategy.py b/src/oscar/apps/partner/strategy.py
--- a/src/oscar/apps/partner/strategy.py
+++ b/src/oscar/apps/partner/strategy.py
@@ -150,7 +150,7 @@ def select_children_stockrecords(self, product):
         Select appropriate stock record for all children of a product
         """
         records = []
-        for child in product.children.all():
+        for child in product.children.public():
             # Use tuples of (child product, stockrecord)
             records.append((child, self.select_stockrecord(child)))
         return records


Test patch:
diff --git a/tests/unit/catalogue/test_managers.py b/tests/unit/catalogue/test_managers.py
new file mode 100644
--- /dev/null
+++ b/tests/unit/catalogue/test_managers.py
@@ -0,0 +1,11 @@
+import pytest
+
+from oscar.apps.catalogue.models import Product
+from oscar.test.factories import ProductFactory
+
+
+@pytest.mark.django_db
+def test_public_queryset_method_filters():
+    ProductFactory(is_public=True)
+    ProductFactory(is_public=False)
+    assert Product.objects.public().count() == 1