Skip to content

Commit

Permalink
Merge pull request #116 from django-oscar/feature/productoptiontypes
Browse files Browse the repository at this point in the history
Oscarapi now correctly keeps the types of product attributes as defined in the ProductType.
  • Loading branch information
Martijn Jacobs committed Jan 16, 2018
2 parents cf01a9e + 059f22f commit 2373d8b
Show file tree
Hide file tree
Showing 11 changed files with 436 additions and 25 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ python:
- '3.6'

env:
- DJANGO=Django==1.8.18 OSCAR=django-oscar==1.2.2
- DJANGO=Django==1.8.18 OSCAR=django-oscar==1.3
- DJANGO=Django==1.8.18 OSCAR=django-oscar==1.4
- DJANGO=Django==1.8.18 OSCAR=django-oscar==1.5.1
- DJANGO=Django==1.10.8 OSCAR=django-oscar==1.4
- DJANGO=Django==1.10.8 OSCAR=django-oscar==1.5.1
- DJANGO=Django==1.11.8 OSCAR=django-oscar==1.5.1
- DJANGO=Django==1.11.9 OSCAR=django-oscar==1.5.1

before_install:
- pip install codecov
Expand Down
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
=========
Changelog
=========
1.3.0 (2018-01-16)
------------------
Features:
* Better support for the different ProductAttribute types in the serializer (including Entity when you implement a `.json()` method on your model)

Notes:
Dropped support for Oscar versions < 1.5(as we support new features which are available since oscar 1.5)

1.2.1 (2017-12-15)
-------------------
Fixes:
Expand Down
16 changes: 3 additions & 13 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ This package provides a RESTful API for `django-oscar`_, it's based on `django-r

Requirements:
-------------
Currently Oscar API is compatbile with python 2.7 / 3.5 / 3.6 and the following django versions:
This version of Oscar API is compatbile with python 2.7 / 3.5 / 3.6 and the following django versions:

Django 1.8:
~~~~~~~~~~~
- Oscar 1.2.2 / 1.3 / 1.4 and 1.5.1
- Oscar 1.5.1
- requires `djangorestframework<3.7`, and `django-tables2<1.17.0`

Django 1.10:
~~~~~~~~~~~~
- Osccar 1.4 and 1.5.1
- Osccar 1.5.1
- requires `djangorestframework>=3.4`

Django 1.11:
Expand Down Expand Up @@ -50,16 +50,6 @@ Please see the installation instructions of `Oscar`_ to install Oscar and how to
Or you could add ``django-oscar-api`` to your project dependencies.

.. warning::

If you want to install Django Oscar API with Oscar 1.5.0, you'll need to use the following command:

.. code-block:: bash
$ pip install django-oscar-api[django_1_11]
This is because of wrong dependency specifications in version 1.5.0. This is fixed in Oscar 1.5.1

.. note::

If you would like to install the current development version, use this:
Expand Down
4 changes: 4 additions & 0 deletions oscarapi/fixtures/attributeoption.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
<field to="catalogue.attributeoptiongroup" name="group" rel="ManyToOneRel">1</field>
<field type="CharField" name="option">Small</field>
</object>
<object pk="2" model="catalogue.attributeoption">
<field to="catalogue.attributeoptiongroup" name="group" rel="ManyToOneRel">1</field>
<field type="CharField" name="option">Large</field>
</object>
</django-objects>
28 changes: 28 additions & 0 deletions oscarapi/fixtures/product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,32 @@
<field type="BooleanField" name="is_discountable">True</field>
<field to="catalogue.option" name="product_options" rel="ManyToManyRel"/>
</object>
<object model="catalogue.product" pk="3">
<field name="structure" type="CharField">standalone</field>
<field name="upc" type="CharField">attrtypestest</field>
<field name="parent" rel="ManyToOneRel" to="catalogue.product"><None></None></field>
<field name="title" type="CharField">lots of attributes</field>
<field name="slug" type="SlugField">lots-of-attributes</field>
<field name="description" type="TextField">&lt;p&gt;It is a test for the attributes&lt;/p&gt;</field>
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="rating" type="FloatField"><None></None></field>
<field name="date_created" type="DateTimeField">2018-01-15T14:20:56.580321+00:00</field>
<field name="date_updated" type="DateTimeField">2018-01-15T14:22:13.099126+00:00</field>
<field name="is_discountable" type="BooleanField">True</field>
<field name="product_options" rel="ManyToManyRel" to="catalogue.option"></field>
</object>
<object model="catalogue.product" pk="4">
<field name="structure" type="CharField">standalone</field>
<field name="upc" type="CharField">entity</field>
<field name="parent" rel="ManyToOneRel" to="catalogue.product"><None></None></field>
<field name="title" type="CharField">Entity product</field>
<field name="slug" type="SlugField">entity-product</field>
<field name="description" type="TextField">&lt;p&gt;An entity&lt;/p&gt;</field>
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">3</field>
<field name="rating" type="FloatField"><None></None></field>
<field name="date_created" type="DateTimeField">2018-01-16T08:51:30.405895+00:00</field>
<field name="date_updated" type="DateTimeField">2018-01-16T08:51:30.405937+00:00</field>
<field name="is_discountable" type="BooleanField">True</field>
<field name="product_options" rel="ManyToManyRel" to="catalogue.option"></field>
</object>
</django-objects>
96 changes: 96 additions & 0 deletions oscarapi/fixtures/productattribute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,100 @@
<field to="catalogue.attributeoptiongroup" name="option_group" rel="ManyToOneRel">1</field>
<field type="BooleanField" name="required">True</field>
</object>
<object model="catalogue.productattribute" pk="2">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">text</field>
<field name="code" type="SlugField">text</field>
<field name="type" type="CharField">text</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="3">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">integer</field>
<field name="code" type="SlugField">integer</field>
<field name="type" type="CharField">integer</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="4">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">boolean</field>
<field name="code" type="SlugField">boolean</field>
<field name="type" type="CharField">boolean</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="5">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">float</field>
<field name="code" type="SlugField">float</field>
<field name="type" type="CharField">float</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="6">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">html</field>
<field name="code" type="SlugField">html</field>
<field name="type" type="CharField">richtext</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="7">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">date</field>
<field name="code" type="SlugField">date</field>
<field name="type" type="CharField">date</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="8">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">datetime</field>
<field name="code" type="SlugField">datetime</field>
<field name="type" type="CharField">datetime</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="9">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">option</field>
<field name="code" type="SlugField">option</field>
<field name="type" type="CharField">option</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup">1</field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="10">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">multioption</field>
<field name="code" type="SlugField">multioption</field>
<field name="type" type="CharField">multi_option</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup">1</field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="11">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">file</field>
<field name="code" type="SlugField">file</field>
<field name="type" type="CharField">file</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="12">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">2</field>
<field name="name" type="CharField">image</field>
<field name="code" type="SlugField">image</field>
<field name="type" type="CharField">image</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
<object model="catalogue.productattribute" pk="13">
<field name="product_class" rel="ManyToOneRel" to="catalogue.productclass">3</field>
<field name="name" type="CharField">entity</field>
<field name="code" type="SlugField">entity</field>
<field name="type" type="CharField">entity</field>
<field name="option_group" rel="ManyToOneRel" to="catalogue.attributeoptiongroup"><None></None></field>
<field name="required" type="BooleanField">False</field>
</object>
</django-objects>

0 comments on commit 2373d8b

Please sign in to comment.