Browse Source

use getattr instead of lazyattribute

master
Martin Winkel 3 years ago
parent
commit
73567d8746
1 changed files with 1 additions and 4 deletions
  1. 1
    4
      src/oscar/test/factories/order.py

+ 1
- 4
src/oscar/test/factories/order.py View File

@@ -2,7 +2,6 @@ from decimal import Decimal as D
2 2
 
3 3
 import factory
4 4
 from django.conf import settings
5
-from django.contrib.sites.models import Site
6 5
 
7 6
 from oscar.core.loading import get_class, get_model
8 7
 from oscar.core.utils import slugify
@@ -60,9 +59,7 @@ class OrderFactory(factory.django.DjangoModelFactory):
60 59
     if hasattr(settings, 'OSCAR_INITIAL_ORDER_STATUS'):
61 60
         status = settings.OSCAR_INITIAL_ORDER_STATUS
62 61
 
63
-    site_id = factory.LazyAttribute(
64
-        lambda o: settings.SITE_ID if hasattr(settings, "SITE_ID") else Site.objects.first()
65
-    )
62
+    site_id = getattr(settings, "SITE_ID", None)
66 63
     number = factory.LazyAttribute(lambda o: '%d' % (100000 + o.basket.pk))
67 64
     basket = factory.SubFactory(
68 65
         'oscar.test.factories.BasketFactory')

Loading…
Cancel
Save