Previously, the 'key' kwarg was not respected and all products would get
added to the first wishlist.
Thanks to @DanielChu for reporting, and supplying a fix.
Fixes #1216
Ensure "active" offers exclude those that are suspended
This required extending the offer factories to support setting the
start- and end-dates (looking forward to using FactoryBoy now). Some
additional tests were added for the active manager.
Fixes #1128
Remove Product.status field and Contributor models
The Contributor models (Contributor, ContributorRole, ProductContributor
and their abstract versions) were unused and too specific to the book
domain.
Product.status was provided as a convenience, but the real world showed
that more often than not, a different field type is necessary. As adding
a field is much easier than changing the field type, it is removed.
I tried to be conservative and mostly converted SlugFields that have
unique=True set.
For PaymentEventType and CommunicationEventType, it was discovered
that setting unique=True was likely forgotten.
As far as I could tell, no forms needed to be changed as they all
exclude the affected slug fields anyway.
Allow explicitly setting slug field even if saving for first time
E.g. Modelname.objects.create(slug='123', name='hi') would otherwise not
work, as add was True (first time save) and AutoSlugField's logic would
just create a slug from the name. It now checks if the slug field is set
already, and if it is, just returns the set slug.
It is important to note that explicitly specifying a slug does skip the
uniqueness validation.
A lot of Oscar's models have slugs that are populated from other fields
in the respective save() methods.
But currently there's no logic to check for duplicate slugs.
AutoSlugField does both the population and ensures uniqueness.
On my local machine, django-dynamic-fixture created product classes
where the slug and primary key were identical and the tests passed
although the check was wrong. Luckily, Murphy's Law works in our favour
on Travis CI, and that failed and spotted it.
This commit fixes the assumption that the redirect view expects the slug
(which it doesn't since the last commit), and ensures that the generated
product classes are non-numeric.
Use Django form to handle product class dropdown in dashboard
Selecting the product class of the product to create used to be done via
hard-coded HTML and no form validation. It is now done The Django
Way(tm).
It also pre-selects the product class if there's only one.
Fixes #838
ef3ccf08a7 introduced a new error block
class. dashboard.js' logic to affix the little red exclamation marks in
the ProductUpdateCreateView then assumed that the forms are full of
errors, even if the error block is empty. Hence empty error blocks are
excluded now.
Also fixed a regression introduced with that commit showing the category
summary.
Fix to allow users to specify which cards they accept.
By default, this works exactly as it did- i.e., any number
can be entered and only a luhn check is run on it.
Users can now overide this behaviour by passing a list of
accepted cards as a 'types'kwarg to BankcardNumberField,
e.g.
BankcardNumberField(types=[bankcards.VISA, bankcards.VISA_ELECTRON,])
If this is specified, we check that the type of card is one we're
aware of and then that the card number matches the pattern for that
type of card
Fixes #949@maikhoepfel rewrote the ImproperlyConfigured check using Python's sets.
Conflicts:
oscar/apps/payment/forms.py
Moved description of what is required of MIDDLEWARE_CLASSES into a single location in the document for easier reference. It appears that BasketMiddleware is easy to miss. I missed it and someone else on the mailing list had the same error.
This is a major performance improvement for pages where the basket is
not used (other pages or loading basket async via javascript).
Note that request.basket is now not available when calling
`apply_offers_to_basket`. Note sure why this is required since the
basket is passed along.
CharField that stores '' as None and returns None as ''
Useful when using unique=True and forms. Implies null==blank==True.
When a ModelForm with a CharField with null=True gets saved, the
field will be set to '': https://code.djangoproject.com/ticket/9590
This breaks usage with unique=True, as '' is considered equal to another
field set to ''.