Skip to content

Commit

Permalink
Merge branch 'master' into releases/1.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Apr 12, 2020
2 parents b7c9393 + af54842 commit 007aa10
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 51 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# django-SHOP

**Django-SHOP** aims to be a the easy, fun and fast e-commerce counterpart to
[django-CMS](https://www.django-cms.org/).

[![Build Status](https://travis-ci.org/awesto/django-shop.svg?branch=master)](https://travis-ci.org/awesto/django-shop?branch=master)
[![PyPI version](https://img.shields.io/pypi/v/django-shop.svg)](https://pypi.python.org/pypi/django-shop)
[![Python versions](https://img.shields.io/pypi/pyversions/django-shop.svg)](https://pypi.python.org/pypi/django-shop)
[![Join the chat at https://gitter.im/awesto/django-shop](https://badges.gitter.im/awesto/django-shop.svg)](https://gitter.im/awesto/django-shop?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Software license](https://img.shields.io/pypi/l/django-shop.svg)](https://pypi.python.org/pypi/django-shop)
[![Twitter Follow](https://img.shields.io/twitter/follow/djangoSHOP.svg?style=social&label=djangoSHOP)](https://twitter.com/djangoSHOP)

**Django-SHOP** aims to be a the easy, fun and fast e-commerce counterpart to
[django-CMS](https://www.django-cms.org/).

Here you can find the [full documentation for django-SHOP](https://django-shop.readthedocs.io/en/latest/).

## Version 1.1 has been released!

See below on how to install it using the Cookiecutter template.
See below on how to install it using the Cookiecutter template. It now supports up to django-CMS 3.7
and Django-2.2.


## Build the database model out of the product's properties – not vice versa
Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
Changelog for django-SHOP
=========================

1.1.1
=====
* Fix: Rendering text for full text index raised an exception.
* Upgrade calls to djangorestframework API to support version 3.9 and later.
* Fix: Generating email during purchansing operation raised an exception.


1.1
===

* Add support for Django-2.2, 2.1. Drop support for Django<1.11.
* Add wrapper around Django's messages framework so that messages can be displayed asynchronously
using a new AngularJS directive ``<toast-messages>``.
* Add endpoint ``fetch_messages`` to fetch JSON description for toast-messages.
Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ atomicwrites==1.3.0
attrs==18.2.0
babel==2.6.0
bleach==3.1.0
certifi==2018.11.29
certifi==2019.11.28
chardet==3.0.4
coverage==4.5.2
docutils==0.14
filelock==3.0.10
idna==2.8
imagesize==1.1.0
jinja2==2.10
jinja2==2.10.3
markupsafe==1.1.0
more-itertools==6.0.0; python_version > '2.7'
packaging==19.0
Expand All @@ -33,6 +33,6 @@ toml==0.10.0
tox==3.7.0
tqdm==4.31.1
twine==1.13.0
urllib3==1.24.1
urllib3==1.25.7
virtualenv==16.4.0
webencodings==0.5.1
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
zip_safe=False,
install_requires=[
'Django>=1.11,<3.0',
'django-post_office>=3.2.0',
'django-filer>=1.4',
'django-ipware>=1.1.1',
'django-fsm>=2.4.0',
'django-fsm-admin>=1.2.4',
'djangorestframework>3.8,<3.9',
'django-angular>2.2',
'Django-Select2<7',
'django-post_office',
'django-filer',
'django-ipware',
'django-fsm',
'django-fsm-admin',
'djangorestframework>=3.9,<4',
'django-angular',
'Django-Select2',
'django-rest-auth',
'django-admin-sortable2>=0.7.4',
'django-formtools>1.0',
'djangocms-cascade>1.1',
'django-admin-sortable2',
'django-formtools',
'djangocms-cascade',
],
)
2 changes: 1 addition & 1 deletion shop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
11. git commit -m 'Start with <version>'
12. git push
"""
__version__ = '1.1.dev'
__version__ = '1.1.1'

default_app_config = 'shop.apps.ShopConfig'
2 changes: 1 addition & 1 deletion shop/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def customer(request):
customer = CustomerModel.objects.get(pk=request.session['emulate_user_id'])
except CustomerModel.DoesNotExist:
customer = VisitingCustomer()
except KeyError:
except (AttributeError, KeyError):
pass
return {'customer': customer}

Expand Down
3 changes: 3 additions & 0 deletions shop/rest/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class JSONSerializerField(serializers.Field):
"""
Serializer field which transparently bypasses its object instead of serializing/deserializing.
"""
def __init__(self, encoder=None, **kwargs):
super(JSONSerializerField, self).__init__(**kwargs)

def to_representation(self, obj):
return obj

Expand Down
6 changes: 5 additions & 1 deletion shop/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class CMSPageCatalogWrapper(object):
:param filter_class: A filter set which must inherit from :class:`django_filters.FilterSet`.
:param pagination_class: A pagination class inheriting from :class:`rest_framework.pagination.BasePagination`.
:param search_serializer_class: The serializer class used to process the queryset returned
by Haystack, while performing an autocomplete lookup.
Expand All @@ -96,6 +98,7 @@ class CMSPageCatalogWrapper(object):
limit_choices_to = models.Q()
search_serializer_class = None # must be overridden by CMSPageCatalogWrapper.as_view()
model_serializer_class = app_settings.PRODUCT_SUMMARY_SERIALIZER # may be overridden by CMSPageCatalogWrapper.as_view()
pagination_class = ProductListPagination
filter_class = None # may be overridden by CMSPageCatalogWrapper.as_view()
filter_backends = [CMSPagesFilterBackend] + list(api_settings.DEFAULT_FILTER_BACKENDS)
cms_pages_fields = ['cms_pages']
Expand All @@ -116,7 +119,8 @@ def as_view(cls, **initkwargs):

bases = (AddFilterContextMixin, AddSearchContextMixin, CMSPageSearchMixin, SearchView)
attrs = dict(renderer_classes=self.renderer_classes, product_model=self.product_model,
limit_choices_to=self.limit_choices_to, filter_class=self.filter_class)
limit_choices_to=self.limit_choices_to, filter_class=self.filter_class,
pagination_class=self.pagination_class)
self.search_view = type(str('CatalogSearchView'), bases, attrs).as_view(
serializer_class=self.search_serializer_class,
)
Expand Down
27 changes: 11 additions & 16 deletions shop/templates/shop/admin/edit_inline/stacked-order.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
{% load i18n admin_urls admin_static %}
<div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
{% load i18n admin_urls static %}
<div class="js-inline-admin-formset inline-group"
id="{{ inline_admin_formset.formset.prefix }}-group"
data-inline-type="stacked"
data-inline-formset="{{ inline_admin_formset.inline_formset_data }}">
<fieldset class="module {{ inline_admin_formset.classes }}">
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
{{ inline_admin_formset.formset.management_form }}
{{ inline_admin_formset.formset.non_form_errors }}

{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b>&nbsp;<span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="inlinechangelink">{% trans "Change" %}</a>{% endif %}
{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b>&nbsp;<span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% trans "Change" %}{% else %}{% trans "View" %}{% endif %}</a>{% endif %}
{% else %}#{{ forloop.counter }}{% endif %}</span>
{% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %}
{% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
{% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
</h3>
{% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %}
{% for fieldset in inline_admin_form %}
{% include "shop/admin/includes/fieldset.html" %}
{% endfor %}
{% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
{{ inline_admin_form.fk_field.field }}
{% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %}
</div>{% endfor %}
</fieldset>
</div>

<script type="text/javascript">
(function($) {
$("#{{ inline_admin_formset.formset.prefix|escapejs }}-group .inline-related").stackedFormset({
prefix: "{{ inline_admin_formset.formset.prefix|escapejs }}",
deleteText: "{% filter escapejs %}{% trans "Remove" %}{% endfilter %}",
addText: "{% filter escapejs %}{% blocktrans with verbose_name=inline_admin_formset.opts.verbose_name|capfirst %}Add another {{ verbose_name }}{% endblocktrans %}{% endfilter %}"
});
})(django.jQuery);
</script>
12 changes: 5 additions & 7 deletions shop/templates/shop/admin/includes/fieldset.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,28 @@
<div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
{% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
{% for field in line %}
<div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
<div{% if not line.fields|length_is:'1' %} class="fieldBox{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
{% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
{% if field.is_checkbox %}
{{ field.field }}{{ field.label_tag }}
{% elif field.field.name|truncatechars:18 == 'render_as_html_...' %}
{{ field.label_tag }}
{% with field.contents as contents %}
{% if contents %}
{% with field.contents as contents %}{% if contents %}
<p>&nbsp;</p>
{{ contents }}
{% else %}
<p></p>
{% endif %}
{% endwith %}
{% endif %}{% endwith %}
{% else %}
{{ field.label_tag }}
{% if field.is_readonly %}
<p>{{ field.contents }}</p>
<div class="readonly">{{ field.contents }}</div>
{% else %}
{{ field.field }}
{% endif %}
{% endif %}
{% if field.field.help_text %}
<p class="help">{{ field.field.help_text|safe }}</p>
<div class="help">{{ field.field.help_text|safe }}</div>
{% endif %}
</div>
{% endfor %}
Expand Down
3 changes: 2 additions & 1 deletion shop/templatetags/shop_search_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def _get_value(self, context, editable=True, **kwargs):

def get_value(self, context, **kwargs):
context.update(sekizai())
context['product'] = context['object']
try:
language_code = context['object']._current_language
language_code = context['product']._current_language
except (KeyError, AttributeError):
language_code = None
context['request'] = EmulateHttpRequest(language_code)
Expand Down
6 changes: 3 additions & 3 deletions shop/urls/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from shop.views.catalog import ProductSelectView

router = routers.DefaultRouter() # TODO: try with trailing_slash=False
router.register(r'cart', CartViewSet, base_name='cart')
router.register(r'watch', WatchViewSet, base_name='watch')
router.register(r'checkout', CheckoutViewSet, base_name='checkout')
router.register(r'cart', CartViewSet, basename='cart')
router.register(r'watch', WatchViewSet, basename='watch')
router.register(r'checkout', CheckoutViewSet, basename='checkout')


def fetch_messages(request):
Expand Down
6 changes: 3 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ djangocms-admin-style==1.3.0
djangocms-bootstrap==1.1.2
djangocms-cascade==1.1.9
djangocms-text-ckeditor==3.8.0
djangorestframework==3.8.2
djangorestframework==3.11.0
drf-haystack==1.8.4
easy-thumbnails==2.6
elasticsearch==1.7.0
Expand All @@ -53,7 +53,7 @@ oauthlib==3.0.1
packaging==19.2
pathlib2==2.3.5; python_version > '2.7'
phonenumbers==8.10.7
Pillow==5.4.1
pillow==7.0.0
pluggy==0.13.1
py==1.8.0
pyparsing==2.4.6
Expand All @@ -73,6 +73,6 @@ text-unidecode==1.2
toml==0.10.0
tox==3.7.0
Unidecode==1.0.23
urllib3==1.24.1
urllib3==1.25.7
webencodings==0.5.1
zipp==0.6.0

0 comments on commit 007aa10

Please sign in to comment.