Giter VIP home page Giter VIP logo

django-oscar-accounts's Introduction

https://github.com/django-oscar/django-oscar/raw/master/docs/images/logos/oscar.png

Domain-driven e-commerce for Django

Oscar is an e-commerce framework for Django designed for building domain-driven sites. It is structured such that any part of the core functionality can be customised to suit the needs of your project. This allows a wide range of e-commerce requirements to be handled, from large-scale B2C sites to complex B2B sites rich in domain-specific business logic.

Contents:

https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/oscarcommerce.thumb.png https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/readthedocs.thumb.png

Further reading:

Continuous integration status:

Coverage Requirements Status

PyPI status:

Docs status:

Documentation Status

Core team:

The currently supported versions of Oscar are:

Version End of support
3.2 LTS January 2026
3.1 April 2022
3.0 May 2021
2.2 LTS August 2023

Supported versions are eligible for fixes for data loss bugs and security issues. Releases designated as Long-term support (LTS) releases will receive support for an extended period of 3 years from their release date.

These are screenshots from the 'sandbox' example site that ships with Oscar. It sports a simple design built with Twitter's Bootstrap and provides a good starting point for rapidly building elegant e-commerce sites.

https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/browse.thumb.png https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/detail.thumb.png https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/basket.thumb.png https://github.com/django-oscar/django-oscar/raw/master/docs/images/screenshots/dashboard.thumb.png

The sandbox site is also available to browse at https://latest.oscarcommerce.com.

The sandbox site can be set-up locally in 5 commands. Want to make changes? Check out the contributing guidelines.

The following extensions are stable and ready for use:

The following are community-written extensions:

Let us know if you're writing a new one!

Videos with talks about Oscar:

Oscar is released under the permissive New BSD license (see summary).

We welcome contributions to the project! Whether it's a bug fix, a new feature, or just some documentation improvements, your contributions are greatly appreciated.

To contribute, please follow these steps:

Fork the project repository on GitHub. Clone your forked repository to your local machine. Create a new branch for your changes. Make your changes, and commit them with clear commit messages. Push your changes to your forked repository. Open a pull request on the original project repository, explaining your changes. Please note that all contributions are subject to review, and may be modified or rejected if they do not meet the project's standards.

We want everyone involved in the project to feel safe and respected, regardless of their background or identity. As such, we have adopted the following Code of Conduct:

In the interest of fostering an open and welcoming environment, we pledge to:

Be friendly and welcoming to all contributors. Respect differing viewpoints and experiences. Accept constructive criticism and feedback graciously. Focus on what is best for the community and the project.

We expect all contributors to:

Use welcoming and inclusive language. Be respectful of differing viewpoints and experiences. Gracefully accept constructive criticism. Focus on what is best for the community and the project.

Project maintainers are responsible for:

Enforcing the Code of Conduct. Investigating and addressing reported violations of the Code of Conduct. Making clear and fair decisions about disciplinary actions for violations of the Code of Conduct. Scope This Code of Conduct applies to all contributors, both online and offline, in all project spaces, including but not limited to project forums, mailing lists, GitHub repositories, and in-person events.

If you witness or experience unacceptable behavior, or have any other concerns, please notify the project maintainers at [email protected] & [email protected]. All reports will be kept confidential, and the project maintainers will work with you to determine a resolution.

We reserve the right to take any action deemed necessary to enforce this Code of Conduct, including but not limited to warning the offender, banning the offender from the project's spaces, or reporting the offender to relevant authorities. Case studies ------------

Oscar is still in active development but is used in production by a range of companies, from large multinationals to small, boutique stores. See http://oscarcommerce.com/cases.html for an overview.

Many more on the way. If you use Oscar in production, please let us know.

If you are interested in having an Oscar project built for you, or for development of an existing Oscar site then please get in touch via [email protected].

django-oscar-accounts's People

Contributors

ajharry69 avatar bitrut avatar catroll avatar codeinthehole avatar costas-basdekis avatar dependabot-preview[bot] avatar dependabot[bot] avatar fmr avatar ibrmora avatar izidormatusov avatar jezdez avatar jyggafey avatar mbertheau avatar mmoravcik avatar mseneshen avatar mvantellingen avatar prince-tanapong avatar solarissmoke avatar turnrdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-oscar-accounts's Issues

ImportError: No module named 'oscar_accounts'

Installed this as per the docs. I get this error.

pip install django-oscar-accounts

python manage.py migrate oscar_accounts

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ryan/apps/oscar/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/ryan/apps/oscar/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 327, in execute
    django.setup()
  File "/home/ryan/apps/oscar/venv/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ryan/apps/oscar/venv/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/ryan/apps/oscar/venv/lib/python3.4/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/home/ryan/apps/oscar/venv/lib64/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'oscar_accounts'

UnicodeDecodeError

When trying to install with pip it gives this error:

% pip install django-oscar-accounts

Collecting django-oscar-accounts
  Using cached django-oscar-accounts-0.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-67a2pzxk/django-oscar-accounts/setup.py", line 12, in <module>
        long_description=open('README.md').read(),
      File "/usr/home/oscar-admin/.env/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 11675: ordinal not in range(128)
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-67a2pzxk/django-oscar-accounts/

Im using Python 3.6.2

Extending accounts templates

I can override some of the templates, but there's a problem when I want to extend account's corresponding template and replace only some of its blocks. Now I get RuntimeError: maximum recursion depth exceeded, because the template I'd like to extend is placed under the same path as the one I want to create.
Can we use Oscar's schema as solution? If want to use actual oscar template we type {% extends 'oscar/path_to_template' %} instead just only {% extends 'path_to_template' %}.

question about settings in django

Hi
ACCOUNTS_SOURCE_NAME - The name of the 'source' account which is used to transfer funds to other accounts (it has no credit limit).

any example how to setup in settings this above path????
Any documentation for oscar-accounts only?

I have no source account defined error ...
I am doing transfer form the shell according ...your guide...

thanks in advance

Nested Account Support?

Hi,

is t possible to create nested accounts?

if not, would you accept pull requests providing this ability:

the use case would be to use oscar-accounts as keystone for accounting applications, by adding the following features:

  • nested account ability (if no parent, the account is a root)
  • account description (only for documentation)

Regards,

Upgrade to support django-3.2

The Django 3.2 has already released, but django-oscar-accounts supports Django 3.0.14. Is there any plan to release a new version to support it? Thank you in advance.

Unable to withdraw funds from account with primary user

If you login to the oscar dashboard as a superuser or a staff user and try to make a withdrawal from a user account that has a primary_user listed, you will not be able to make the withdrawal.

Error message: "Unable to withdraw funds from account: This user is not authorised to make transfers from this account"

Code in question is in can_be_authorized_by() in abstract_models.py line 220:

 def can_be_authorised_by(self, user=None):
        """
        Test whether the passed user can authorise a transfer from this account
        """
        if user is None:
            return True
        if self.primary_user:
            return user == self.primary_user
        secondary_users = self.secondary_users.all()
        if secondary_users.count() > 0:
            return user in secondary_users
        return True

How is a staff or superuser supposed to withdraw from an account? Am I using primary_user wrong?

Seems like there should be:

if user.is_staff or user.is_superuser:
    return True

in that function.

Thanks

How to hide navigation accounts when partner status

Hi, i trying for develop django-oscar for market place and i using django-oscar-account for paymen method. when i create partnet in oscar, the menu accounts still show. how to configure visibility navigation Accounts in dashboard when partner login ?

Running standalone on Django 1.7

There seems to be a System Check in Django 1.7 that is causing a fail when loading.

I am running oscar accounts as a standalone without oscar itself.

Here is the error:

accounts.Account.product_range: (fields.E300) Field defines a relation with model 'offer.Range', which is either not installed, or is abstract.

And here are the lines from abstract models that define the problem.

# Accounts are sometimes restricted to only work on a specific range of
# products.  This is the only link with Oscar.
product_range = models.ForeignKey('offer.Range', null=True, blank=True)

Do I need to install Oscar just to be able to use the accounts component?

Error while making migrations

Hi,
I get an error while trying to run python manage.py makemigrations the error is:
from django.core.urlresolvers import reverse ModuleNotFoundError: No module named 'django.core.urlresolvers'

can't init

Hello,
I followed the default install process, no tweak.

python manage.py oscar_accounts_init
Traceback (most recent call last):
  File "/home/pm/Documents/github/django_tests/django-oscar/frobshop/manage.py", line 22, in <module>
    main()
  File "/home/pm/Documents/github/django_tests/django-oscar/frobshop/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/oscar_accounts/management/commands/oscar_accounts_init.py", line 10, in handle
    create_default_accounts()
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/oscar_accounts/setup.py", line 12, in create_default_accounts
    sales.accounts.create(name=names.REDEMPTIONS)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/db/models/fields/related_descriptors.py", line 799, in create
    return super(RelatedManager, self.db_manager(db)).create(**kwargs)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/db/models/query.py", line 658, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/oscar_accounts/abstract_models.py", line 149, in save
    self.balance = self._balance()
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/oscar_accounts/abstract_models.py", line 153, in _balance
    aggregates = self.transactions.aggregate(sum=Sum('amount'))
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/pm/Documents/github/django_tests/django-oscar/oscar/lib/python3.10/site-packages/django/db/models/fields/related_descriptors.py", line 718, in get_queryset
    raise ValueError(
ValueError: 'Account' instance needs to have a primary key value before this relationship can be used.

Tables are in place:

python manage.py migrate oscar_accounts
Operations to perform:
  Apply all migrations: oscar_accounts
Running migrations:
  No migrations to apply.

My versions:

pip freeze
asgiref==3.7.2
Babel==2.14.0
certifi==2023.11.17
charset-normalizer==3.3.2
Django==4.2.9
django-extra-views==0.14.0
django-haystack==3.2.1
django-oscar==3.2.2
django-oscar-accounts==3.0.1
django-phonenumber-field==6.4.0
django-tables2==2.3.4
django-treebeard==4.7
django-widget-tweaks==1.5.0
factory-boy==3.2.1
Faker==22.2.0
idna==3.6
phonenumbers==8.13.28
pillow==10.2.0
purl==1.6
pysolr==3.9.0
python-dateutil==2.8.2
requests==2.31.0
six==1.16.0
sorl-thumbnail==12.9.0
sqlparse==0.4.4
typing_extensions==4.9.0
urllib3==2.1.0

Any idea?

Account.save() fails in Django 4.2

In Django 4.2, calling manager methods on non-persisted instances is no longer allowed. This change causes Account.save() to fail on any Account that hasn't been previously saved, because the Account._balance() method calls self.transactions.aggregate() before the Account is in the database:

  File ".../helpers.py", line 320, in create_account
    account_type.accounts.create(
  File ".../lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 799, in create
    return super(RelatedManager, self.db_manager(db)).create(**kwargs)
  File ".../lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File ".../lib/python3.8/site-packages/django/db/models/query.py", line 658, in create
    obj.save(force_insert=True, using=self.db)
  File ".../lib/python3.8/site-packages/oscar_accounts/abstract_models.py", line 149, in save
    self.balance = self._balance()
  File ".../lib/python3.8/site-packages/oscar_accounts/abstract_models.py", line 153, in _balance
    aggregates = self.transactions.aggregate(sum=Sum('amount'))
  File ".../lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File ".../lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 718, in get_queryset
    raise ValueError(
ValueError: 'Account' instance needs to have a primary key value before this relationship can be used.

Can't run apps.checkout from sandbox

Can't run apps.checkout from sandbox demo

With actual Django-Oscar and actual version of Django-Oscar-Accounts (from repo, not from pypi) - error message at ctx['to_allocate'] = ctx['order_total_incl_tax'] - allocations.total string.

What is ctx['order_total_incl_tax'] ? May be ctx['order_total'].incl_tax ?

I think this is a bug in apps.checkout.

Field defines a relation with model 'offer.Range', which is either not installed, or is abstract

I am using Django==1.8.13, Ptyhon 3.5.1+

I installed django-oscar-accounts==0.4rc2.dev2+ngbe57d82 (latest master)

But I am getting following error when i do
python manage.py migrate oscar_accounts

SystemCheckError: System check identified some issues:

ERRORS:
oscar_accounts.Account.product_range: (fields.E300) Field defines a relation with model 'offer.Range', which is either not installed, or is abstract.
`

Not Oscar-independant

Running

pip install django-oscar-accounts
(adding oscar_accounts to installed apps)
python manage.py migrate oscar_accounts

Yields:

SystemCheckError: System check identified some issues:

ERRORS:
oscar_accounts.Account.product_range: (fields.E300) Field defines a relation with model 'offer.Range', which is either not installed, or is abstract.
oscar_accounts.Account.product_range: (fields.E307) The field oscar_accounts.Account.product_range was declared with a lazy reference to 'offer.range', but app 'offer' isn't installed.

Upgrade to support django-3.0 and oscar-2.1

Dear authors,
The Django 3.0 and oscar 2.1 have already released, but django-oscar-accounts doesn't support both. Is there any plan to release a new version to support them? Thank you in advance.

wrong logic for AllocationForm.get_max_amount

problem occurs: order total= 20, you have 2 accounts with each balance is 10.

suggest:
return max_allocation - self.allocations.total
->
return min(max_allocation, self.order_total - self.allocations.total)

Dashboard integration with django-oscar trunk

I've been attempting to integrate django-oscar-accounts into django-oscar's latest trunk, looking forward to the release of django-oscar 0.6. Unfortunately, I'm running into problems. Specifically, with an urls.py containing:

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from oscar.app import application
from accounts.dashboard.app import application as accounts_app
from accounts.views import AccountBalanceView

admin.autodiscover()

urlpatterns = patterns('',
    (r'', include(application.urls)),
    (r'^admin/', include(admin.site.urls)),
    url(r'^giftcard-balance/', AccountBalanceView.as_view(), name="account-balance"),
    (r'^dashboard/accounts/', include(accounts_app.urls)),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

And a settings.py containing the statement:

OSCAR_DASHBOARD_NAVIGATION.append({
    'label': 'Accounts',
    'icon': 'icon-globe',
    'children': [
        {
            'label': 'Accounts',
            'url_name': 'accounts-list',
        },
        {
            'label': 'Transfers',
            'url_name': 'transfers-list',
        },
        {
            'label': 'Deferred income report',
            'url_name': 'report-deferred-income',
        },
        {
            'label': 'Profit/loss report',
            'url_name': 'report-profit-loss',
        },
    ]
})

Rendering any dashboard page throws an IndexError in oscar/apps/dashboard/nav.py, on the statement:

view_name = self.url_name.split(':')[1]

This is due to url_name not containing a namespace. Attempting to manually namespace the views resolves this issue, however will then throw an error when rendering any django-oscar-accounts dashboard page, as the templates do not reference a namespace.

I'm not skilled enough with django-oscar to know if what I'm doing is wrong, but I'm basing my code on the sandbox app contained within django-oscar-accounts.

Dependency mismatch: python-dateutil

Current version (0.3) is not installable through pip due to python-dateutil version mismatch:

pip install django-oscar-accounts
....
faker 0.9.0 has requirement python-dateutil>=2.4, but you'll have python-dateutil 2.1 which is incompatible.

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

import url error.

Got this error when try to add to urls.py with django 1.11.5

root@661e03d02baa:/application# python manage.py runserver
Performing system checks...

Unhandled exception in thread started by <function check_errors..wrapper at 0x7faf22e140d0>
Traceback (most recent call last):
File "/appenv/lib/python3.4/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/appenv/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/appenv/lib/python3.4/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/appenv/lib/python3.4/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/appenv/lib/python3.4/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/appenv/lib/python3.4/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/appenv/lib/python3.4/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/appenv/lib/python3.4/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/appenv/lib/python3.4/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/appenv/lib/python3.4/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/appenv/lib/python3.4/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/appenv/lib/python3.4/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/appenv/lib/python3.4/importlib/init.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2254, in _gcd_import
File "", line 2237, in _find_and_load
File "", line 2226, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "/application/oscar_phenom_health/urls.py", line 24, in
from oscar_accounts.dashboard.app import application as accounts_app
File "/appenv/lib/python3.4/site-packages/oscar_accounts/dashboard/app.py", line 1, in
from django.conf.urls import patterns, url
ImportError: cannot import name 'patterns

Explicit "dashboard" namespaced urls.

I'm using accounts with oscar dashboard and none of the templates are able to reverse the urls.

This is what I'm using to add accounts to my oscar app in dashboard/app.py:

from django.conf.urls import patterns, url, include
from oscar.apps.dashboard.app import DashboardApplication as CoreDashboardApplication
from accounts.dashboard.app import application as accounts_app

class DashboardApplication(CoreDashboardApplication):
    def get_urls(self):
        urlpatterns = super(DashboardApplication, self).get_urls()
        urlpatterns += patterns('',
            url(r'^accounts/', include(accounts_app.urls)),
        )
        return urlpatterns

application = DashboardApplication()

When I extend it like that the only way to reference the URLs now is by prepending the "dashboard:" namespace.

Seems like this is a reasonable use case. Am I doing it the wrong way or is this just something not supported yet?

I guess I have two options going forward: copy all of the templates from accounts and fix the url reverse to add the namespace or add the accounts app by not using the DashboardApplication instance (directly in the root urls.py).

Breaks with django 1.6

File "/home/diego/mydata/.virtualenvs/dropship/local/lib/python2.7/site-packages/accounts/dashboard/app.py", line 1, in
from django.conf.urls.defaults import patterns, url
ImportError: No module named defaults

In django 1.6:
from django.conf.urls import patterns, url

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.