Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add address settings #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

karimone
Copy link

Prior to this change to modify the address javascript you had to fork
and edit the address.js manually. This change let to define a setting
dict to customize the address.js.

e.g.

ADDRESS_SETTINGS = {
    'country': ['AU'],
}

it will be injected in the address.js to limit the address to the
australian country.

To achieve that I move the address.js from a static file to a
templateview and threat the address.js file as a django template.

The TemplateView is responsible to retrieve the settings and generate
the context for the template.

There is a requirement to make django-address works now. The url must be
added in your project:

e.g.

urlpatterns = [
    # ... other urls
    path('address/', include('address.urls')),
]

Prior to this change to modify the address javascript you had to fork
and edit the `address.js` manually. This change let to define a setting
dict to customize the address.js.

e.g.

```
ADDRESS_SETTINGS = {
    'country': ['AU'],
}
```
it will be injected in the address.js to limit the address to the
australian country.

To achieve that I move the address.js from a static file to a
templateview and threat the address.js file as a django template.

The TemplateView is responsible to retrieve the settings and generate
the context for the template.

There is a requirement to make django-address works now. The url must be
added in your project:

e.g.

```
urlpatterns = [
    # ... other urls
    path('address/', include('address.urls')),
]
```
@karimone
Copy link
Author

I did some tests and I have a circular import issue, I'll have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant