Forking an app

This guide explains how to fork an app in Oscar.


The following steps are now automated by the oscar_fork_app management command. They’re explained in detail so you get an idea of what’s going on. But there’s no need to do this manually anymore!

Create Python module with same label

You need to create a Python module with the same “app label” as the Oscar app you want to extend. E.g., to create a local version of oscar.apps.order, do the following:

$ mkdir yourproject/order
$ touch yourproject/order/

Reference Oscar’s models

If the original Oscar app has a, you’ll need to create a file in your local app. It should import all models from the Oscar app being overridden:

# yourproject/order/

# your custom models go here

from oscar.apps.order.models import *

If two models with the same name are declared within an app, Django will only use the first one. That means that if you wish to customise Oscar’s models, you must declare your custom ones before importing Oscar’s models for that app.

You have to copy the migrations directory from oscar/apps/order and put it into your order app. Detailed instructions are available in How to customise models.

Get the Django admin working

When you replace one of Oscar’s apps with a local one, Django admin integration is lost. If you’d like to use it, you need to create an and import the core app’s (which will run the register code):

# yourproject/order/
import oscar.apps.order.admin

This isn’t great but we haven’t found a better way as of yet.

Django 1.7+: Use supplied app config

Oscar ships with an app config for each app, which sets app labels and runs startup code. You need to make sure that happens.