選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

__init__.py 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import os
  2. # Use 'final' as the 4th element to indicate
  3. # a full release
  4. VERSION = (0, 2, 0, 'RC', 1)
  5. def get_short_version():
  6. return '%s.%s' % (VERSION[0], VERSION[1])
  7. def get_version():
  8. version = '%s.%s' % (VERSION[0], VERSION[1])
  9. if VERSION[2]:
  10. # Append 3rd digit if > 0
  11. version = '%s.%s' % (version, VERSION[2])
  12. if VERSION[3:] == ('alpha', 0):
  13. version = '%s pre-alpha' % version
  14. elif VERSION[3] != 'final':
  15. version = '%s %s %s' % (version, VERSION[3], VERSION[4])
  16. return version
  17. # Cheeky setting that can be used to override templates and give them
  18. # the same name. You can use:
  19. #
  20. # {% includes 'templates/basket/basket.html' %}
  21. #
  22. # when you want to create a new template with path 'basket/basket.html'
  23. # Just add this setting to the end of your TEMPLATE_DIRS setting.
  24. OSCAR_PARENT_TEMPLATE_DIR = os.path.dirname(os.path.abspath(__file__))
  25. OSCAR_CORE_APPS = [
  26. 'oscar',
  27. 'oscar.apps.analytics',
  28. 'oscar.apps.order',
  29. 'oscar.apps.checkout',
  30. 'oscar.apps.shipping',
  31. 'oscar.apps.catalogue',
  32. 'oscar.apps.catalogue.reviews',
  33. 'oscar.apps.basket',
  34. 'oscar.apps.payment',
  35. 'oscar.apps.offer',
  36. 'oscar.apps.address',
  37. 'oscar.apps.partner',
  38. 'oscar.apps.customer',
  39. 'oscar.apps.promotions',
  40. 'oscar.apps.search',
  41. 'oscar.apps.voucher',
  42. 'oscar.apps.dashboard',
  43. 'oscar.apps.dashboard.reports',
  44. 'oscar.apps.dashboard.users',
  45. 'oscar.apps.dashboard.orders',
  46. 'oscar.apps.dashboard.promotions',
  47. 'oscar.apps.dashboard.catalogue',
  48. 'oscar.apps.dashboard.offers',
  49. 'oscar.apps.dashboard.ranges',
  50. 'oscar.apps.dashboard.vouchers',
  51. 'django_sorting',
  52. ]
  53. def get_core_apps(overrides=None):
  54. """
  55. Return a list of oscar's apps amended with any passed overrides
  56. """
  57. if overrides is None:
  58. return OSCAR_CORE_APPS
  59. def get_app_label(app_label, overrides):
  60. pattern = app_label.replace('oscar.apps.', '')
  61. for override in overrides:
  62. if override.endswith(pattern):
  63. return override
  64. return app_label
  65. apps = []
  66. for app_label in OSCAR_CORE_APPS:
  67. apps.append(get_app_label(app_label, overrides))
  68. return apps
  69. return OSCAR_CORE_APPS