Browse Source

Remove deprecated methods from catalogue models and views

master
David Winterbottom 11 years ago
parent
commit
eef2cd3083

+ 10
- 2
docs/source/releases/v0.8.rst View File

@@ -152,5 +152,13 @@ Migrations
152 152
 
153 153
 .. _deprecated_features:
154 154
 
155
-Features deprecated in 0.8
156
-==========================
155
+Removal of deprecated features
156
+------------------------------
157
+
158
+These methods have been removed:
159
+
160
+* ``oscar.apps.catalogue.abstract_models.AbstractProduct.has_stockrecord``
161
+* ``oscar.apps.catalogue.abstract_models.AbstractProduct.stockrecord``
162
+* ``oscar.apps.catalogue.abstract_models.AbstractProduct.is_available_to_buy``
163
+* ``oscar.apps.catalogue.abstract_models.AbstractProduct.is_purchase_permitted``
164
+* ``oscar.apps.catalogue.views.get_product_base_queryset``

+ 0
- 59
oscar/apps/catalogue/abstract_models.py View File

@@ -1,6 +1,5 @@
1 1
 import os
2 2
 import six
3
-import warnings
4 3
 from itertools import chain
5 4
 from datetime import datetime, date
6 5
 import logging
@@ -374,64 +373,6 @@ class AbstractProduct(models.Model):
374 373
             pairs.append(value.summary())
375 374
         return ", ".join(pairs)
376 375
 
377
-    # Deprecated stockrecord methods
378
-
379
-    @property
380
-    def has_stockrecord(self):
381
-        """
382
-        Test if this product has a stock record
383
-        """
384
-        warnings.warn(("Product.has_stockrecord is deprecated in favour of "
385
-                       "using the stockrecord template tag.  It will be "
386
-                       "removed in v0.8"), DeprecationWarning)
387
-        return self.num_stockrecords > 0
388
-
389
-    @property
390
-    def stockrecord(self):
391
-        """
392
-        Return the stockrecord associated with this product.  For backwards
393
-        compatibility, this defaults to choosing the first stockrecord found.
394
-        """
395
-        # This is the old way of fetching a stockrecord, when they were
396
-        # one-to-one with a product.
397
-        warnings.warn(("Product.stockrecord is deprecated in favour of "
398
-                       "using the stockrecord template tag.  It will be "
399
-                       "removed in v0.7"), DeprecationWarning)
400
-        try:
401
-            return self.stockrecords.all()[0]
402
-        except IndexError:
403
-            return None
404
-
405
-    @property
406
-    def is_available_to_buy(self):
407
-        """
408
-        Test whether this product is available to be purchased
409
-        """
410
-        warnings.warn(("Product.is_available_to_buy is deprecated in favour "
411
-                       "of using the stockrecord template tag.  It will be "
412
-                       "removed in v0.7"), DeprecationWarning)
413
-        if self.is_group:
414
-            # If any one of this product's variants is available, then we treat
415
-            # this product as available.
416
-            for variant in self.variants.select_related('stockrecord').all():
417
-                if variant.is_available_to_buy:
418
-                    return True
419
-            return False
420
-        if not self.get_product_class().track_stock:
421
-            return True
422
-        return self.has_stockrecord and self.stockrecord.is_available_to_buy
423
-
424
-    def is_purchase_permitted(self, user, quantity):
425
-        """
426
-        Test whether this product can be bought by the passed user.
427
-        """
428
-        warnings.warn(("Product.is_purchase_permitted is deprecated in favour "
429
-                       "of using a partner strategy.  It will be "
430
-                       "removed in v0.7"), DeprecationWarning)
431
-        if not self.has_stockrecords:
432
-            return False, _("No stock available")
433
-        return self.stockrecord.is_purchase_permitted(user, quantity, self)
434
-
435 376
     @property
436 377
     def min_variant_price_incl_tax(self):
437 378
         """

+ 0
- 12
oscar/apps/catalogue/views.py View File

@@ -1,4 +1,3 @@
1
-import warnings
2 1
 from django.conf import settings
3 2
 from django.http import HttpResponsePermanentRedirect
4 3
 from django.shortcuts import get_object_or_404
@@ -99,17 +98,6 @@ class ProductDetailView(DetailView):
99 98
             '%s/detail.html' % (self.template_folder)]
100 99
 
101 100
 
102
-def get_product_base_queryset():
103
-    """
104
-    Deprecated. Kept only for backwards compatibility.
105
-    Product.browsable.base_queryset() should be used instead.
106
-    """
107
-    warnings.warn(("`get_product_base_queryset` is deprecated in favour of"
108
-                   "`base_queryset` on Product's managers. It will be removed"
109
-                   "in Oscar 0.7."), DeprecationWarning)
110
-    return Product.browsable.base_queryset()
111
-
112
-
113 101
 class ProductCategoryView(ListView):
114 102
     """
115 103
     Browse products in a given category

Loading…
Cancel
Save