An extension for Oscar to include stores
Project description
This is an extension for django-oscar that adds support for stores. It provides:
A store locator page using Google maps for geocoding. It also supports using the browser’s location to show the nearest stores.
Store detail pages including opening hours
Store groups
A dashboard for managing stores
It’s highly extensible and can be used as a foundation for building sophisticated stores functionality within Oscar sites.
Screenshots
Customer-facing pages:
Dashboard pages:
Dependencies
GeoDjango is used so a spatial database is required. We recommend PostGIS. Django’s docs include some installation instructions although it is renowned for being tricky.
Spatialite is another option although it can be tricky to set up. On Ubuntu, you can do the following:
$ sudo apt-get install spatialite-bin libspatialite3 libgeos++-dev libgdal-dev libproj0
The pysqlite python package is also required although it doesn’t support C extensions by default. To work-around this, there are two options:
Download the package, edit setup.cfg to enable C extensions and install:
$ pip install pysqlite --no-install
$ vim $VIRTUAL_ENV/build/pysqlite/setup.cfg
$ pip install pysqlite
Use a custom branch:
$ pip install git+git://github.com/tinio/pysqlite.git@extension-enabled#egg=pysqlite
Installation
First, ensure you are using a spatial database and have django-oscar installed.
Install package:
$ pip install django-oscar-stores
Then add stores and stores.dashboard to INSTALLED_APPS.
Now update your root urls.py:
from django.views.i18n import JavaScriptCatalog
urls = [
# basic configuration for Oscar
path('', include(apps.get_app_config('oscar').urls[0])),
# adds URLs for the dashboard store manager
path('dashboard/stores/', apps.get_app_config('stores_dashboard').urls),
# adds URLs for overview and detail pages
path('stores/', apps.get_app_config('stores').urls),
# adds internationalization URLs
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
]
Settings
GOOGLE_MAPS_API_KEY (default: not set). Maps API key for use with Maps and Geocode APIs. You must provide this key.
STORES_GEOGRAPHIC_SRID (default: 3577). This is used for distance calculations. See http://spatialreference.org for more details.
STORES_GEODETIC_SRID (default: 4326).
STORES_MAX_SEARCH_DISTANCE (default: None). This filters stores in queries by distance. Units can be set using distance object:
from django.contrib.gis.measure import D
# Maximal distance of 150 miles
STORES_MAX_SEARCH_DISTANCE = D(mi=150)
# Maximal distance of 150 kilometers
STORES_MAX_SEARCH_DISTANCE = D(km=150)
Contributing
There is sandbox site within the repo which is a sample Oscar project that uses the stores extension. Set this up with:
$ make sandbox
This loads a fixture which provides a superuser to test the dashboard with:
email: superuser@example.com username: superuser password: testing
Run tests with:
$ pytest
License
django-oscar-stores is released under the permissive New BSD license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-oscar-stores-3.0.1.tar.gz
.
File metadata
- Download URL: django-oscar-stores-3.0.1.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 263cd3d1033f0075867fa4b7f663266152fa9e704172e8d66bf17f82f43e4053 |
|
MD5 | 42ca51d39be381f59410ada46943b2ad |
|
BLAKE2b-256 | dd4877e05ad2c89244e18da04a1e540ce065342ae04d4bc0ed0afeb625fcb932 |
File details
Details for the file django_oscar_stores-3.0.1-py3-none-any.whl
.
File metadata
- Download URL: django_oscar_stores-3.0.1-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b581efae271aa91d8ec36a281b35ca7a5c66b92973cab34deeb5aad8c5f064 |
|
MD5 | ee276c91f7145d8655ea7a5a87d797d9 |
|
BLAKE2b-256 | 9ffbf9396d9afca5de005917fa37c3d80fcf5167e27c7e1c944606b53b35227b |