从Django-Oscar扩展客户的观点

时间:2015-02-23 13:55:50

标签: python django django-oscar

我正试图在django-oscar中覆盖客户应用程序。为此,我在项目的app文件夹中创建了客户应用程序。当我运行该项目时,我在django 1.7.4中遇到如下错误:

django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: customer

我浏览了django https://docs.djangoproject.com/en/1.7/ref/applications/#django.apps.AppConfig中的文档,但它没有成功。那么有没有其他方法来扩展任何django-oscar的应用程序并根据要求修改代码。

这是我的客户应用的views.py:

from oscar.apps.customer.views import ProfileView as CoreProfileView

class ProfileView(CoreProfileView):
    template_name = 'new_account.html'

及以下是项目的settings.py代码段:

INSTALLED_APPS = [
    'apps.customer',
]

提前致谢。

1 个答案:

答案 0 :(得分:4)

运行此命令以覆盖来自django oscar的应用程序

./manage.py oscar_fork_app appname yourprojectname

yourprojectname - 应用程序创建位置的文件夹路径

运行此命令后,将使用覆盖的模型,管理文件创建一个新的应用程序。现在添加应用程序路径

settings.py文件中的

get_core_apps(['yourproject.order'])

有关详细信息,请参阅

http://django-oscar.readthedocs.org/en/latest/topics/customisation.html