You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import os
  2. # Use 'final' as the 4th element to indicate
  3. # a full release
  4. VERSION = (0, 8, 0, 'dev')
  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. # Append 3rd digit if > 0
  10. if VERSION[2]:
  11. version = '%s.%s' % (version, VERSION[2])
  12. elif VERSION[3] != 'final':
  13. version = '%s %s' % (version, VERSION[3])
  14. if len(VERSION) == 5:
  15. version = '%s %s' % (version, VERSION[4])
  16. return version
  17. # Cheeky setting that allows each template to be accessible by two paths.
  18. # Eg: the template 'oscar/templates/oscar/base.html' can be accessed via both
  19. # 'base.html' and 'oscar/base.html'. This allows Oscar's templates to be
  20. # extended by templates with the same filename
  21. OSCAR_MAIN_TEMPLATE_DIR = os.path.join(
  22. os.path.dirname(os.path.abspath(__file__)), 'templates/oscar')
  23. OSCAR_CORE_APPS = [
  24. 'oscar',
  25. 'oscar.apps.analytics',
  26. 'oscar.apps.checkout',
  27. 'oscar.apps.address',
  28. 'oscar.apps.shipping',
  29. 'oscar.apps.catalogue',
  30. 'oscar.apps.catalogue.reviews',
  31. 'oscar.apps.partner',
  32. 'oscar.apps.basket',
  33. 'oscar.apps.payment',
  34. 'oscar.apps.offer',
  35. 'oscar.apps.order',
  36. 'oscar.apps.customer',
  37. 'oscar.apps.promotions',
  38. 'oscar.apps.search',
  39. 'oscar.apps.voucher',
  40. 'oscar.apps.wishlists',
  41. 'oscar.apps.dashboard',
  42. 'oscar.apps.dashboard.reports',
  43. 'oscar.apps.dashboard.users',
  44. 'oscar.apps.dashboard.orders',
  45. 'oscar.apps.dashboard.promotions',
  46. 'oscar.apps.dashboard.catalogue',
  47. 'oscar.apps.dashboard.offers',
  48. 'oscar.apps.dashboard.partners',
  49. 'oscar.apps.dashboard.pages',
  50. 'oscar.apps.dashboard.ranges',
  51. 'oscar.apps.dashboard.reviews',
  52. 'oscar.apps.dashboard.vouchers',
  53. 'oscar.apps.dashboard.communications',
  54. # 3rd-party apps that oscar depends on
  55. 'haystack',
  56. 'treebeard',
  57. 'sorl.thumbnail',
  58. 'django_tables2',
  59. ]
  60. def get_core_apps(overrides=None):
  61. """
  62. Return a list of oscar's apps amended with any passed overrides
  63. """
  64. if not overrides:
  65. return OSCAR_CORE_APPS
  66. def get_app_label(app_label, overrides):
  67. pattern = app_label.replace('oscar.apps.', '')
  68. for override in overrides:
  69. if override.endswith(pattern):
  70. if 'dashboard' in override and 'dashboard' not in pattern:
  71. continue
  72. return override
  73. return app_label
  74. apps = []
  75. for app_label in OSCAR_CORE_APPS:
  76. apps.append(get_app_label(app_label, overrides))
  77. return apps