The dashboard is the backend interface for managing the store. That includes the
product catalogue, orders and stock, offers etc. It is intended as a
complete replacement of the Django admin interface.
The app itself only contains a view that serves as a kind of homepage, and
some logic for managing the navigation (in
nav.py). There’s several sub-apps
that are responsible for managing the different parts of the Oscar store.
Staff users (users with
is_staff==True) get access to all views in the
dashboard. To better support Oscar’s use for marketplace scenarios, the
permission-based dashboard has been introduced. If a non-staff user has
partner.dashboard_access permission set, they are given access to a subset
of views, and their access to products and orders is limited.
If a non-staff user with the
partner.dashboard_access permission is in
users, they can:
Create products. It is enforced that at least one stock record’s partner has the current user in
Update products. At least one stock record must have the user in the stock record’s partner’s
Delete and list products. Limited to products the user is allowed to update.
Managing orders. Similar to products, a user get access if one of an order’s lines is associated with a matching partner. By default, user will get access to all lines of the order, even though supplies only one of them. If you need user to see only own lines or apply additional filtering - you can customize
For many marketplace scenarios, it will make sense to ensure at checkout that a basket only contains lines from one partner. Please note that the dashboard currently ignores any other permissions, including Django’s default permissions.
The permission-based dashboard currently does not support parent or child products. Supporting this requires a modelling change. If you require this, please get in touch so we can first learn about your use case.
An overview view which displays several reports about the shop.
Supports the permission-based dashboard. It is recommended to add a index_nonstaff.html template because Oscar’s default template will display potentially sensitive store information.
Return active conditional offers of type “site offer”. The returned
Querysetof site offers is filtered by end date greater then the current date.
Get all active vouchers. The returned
Querysetof vouchers is filtered by end date greater then the current date.
get_hourly_report(orders, hours=24, segments=10)¶
Get report of order revenue split up in hourly chunks. A report is generated for the last hours (default=24) from the current time. The report provides
max_revenueof the hourly order revenue sum,
y-rangeas the labeling for the y-axis in a template and
order_total_hourly, a list of properties for hourly chunks. segments defines the number of labeling segments used for the y-axis when generating the y-axis labels (default=10).
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.