django-oscar-accounts
django-oscar-accounts copied to clipboard
Dashboard templates doesn't load after app override
I override oscar_accounts app, because I want customize models, but dashboard templates doesn't load after that. Is it possible somehow reuse dashboard templates from original oscar_accounts app? Thank you!
my_project.oscar_accounts.apps.py
from oscar_accounts import apps
class AccountsConfig(apps.AccountsConfig):
name = 'my_project.oscar_accounts'
my_project.oscar_accounts.models.py
from oscar_accounts import abstract_models
class AccountType(abstract_models.AccountType):
pass
class Account(abstract_models.Account):
pass
class Transfer(abstract_models.Transfer):
pass
class Transaction(abstract_models.Transaction):
pass
class IPAddressRecord(abstract_models.IPAddressRecord):
pass
settings.py
...
# Oscar Accounts
'my_project.oscar_accounts.apps.AccountsConfig',
'oscar_accounts.dashboard.apps.AccountsDashboardConfig',
'oscar_accounts.api.apps.AccountsAPIConfig',
...
Error:
TemplateDoesNotExist at /en/dashboard/accounts/
accounts/dashboard/account_list.html, oscar_accounts/account_list.html
Request Method: GET
Request URL: http://localhost:8000/en/dashboard/accounts/
Django Version: 3.0.8
Exception Type: TemplateDoesNotExist
Exception Value: accounts/dashboard/account_list.html, oscar_accounts/account_list.html
Exception Location: ../site-packages/django/template/loader.py in select_template, line 47
Django's app template loader will not work in this case - because the core accounts app is no longer installed. What you can do is add the path to the core accounts template folder in your TEMPLATES['DIRS']
setting.
It seems that this is not the best solution for production, depending on the environment, the path to the folder may be different, and it will need to be specified for each case separately
Maybe the best way would be to spread the templates and models to different applications? for example, leave templates in oscar_accounts and transfer models to oscar_accounts.core, or vice versa, then the templates will work and the application with models can be forked using oscar_fork_app