jazzband / django-recurrence

Utility for working with recurring dates in Django.
https://django-recurrence.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
491 stars 190 forks source link

Replaced code to search for JS catalog file with setting/default #154

Closed nlittlejohns closed 3 years ago

nlittlejohns commented 5 years ago

Related to issue #147

Removed the find_recurrence_i18n_js_catalog function and replaced it with a setting in the two places it's used:

i18n_media = getattr(settings, 'JAVASCRIPT_CATALOG_PATH', '/jsi18n/recurrence')
_recurrence_javascript_catalog_url = getattr(settings, 'JAVASCRIPT_CATALOG_PATH', '/jsi18n/recurrence')

If this is merged, the documentation will need to be updated to include new information about how to specify the JS Catalog file. I'd recommend this as the suggested pattern:

urlpatterns += [
    path('jsi18n/recurrence/',
         JavaScriptCatalog.as_view(packages=['recurrence']),
         name='javascript-catalog'),
]

The documentation should also mention that the user can specify their own custom path to the catalog with the setting JAVASCRIPT_CATALOG_PATH, e.g: JAVASCRIPT_CATALOG_PATH = 'mypath/jsi18n'

This is my first ever pull request, let me know if I've done anything wrong!

nlittlejohns commented 5 years ago

Just found a problem with this solution: Works fine running locally, but when running on my server the path changes from /jsi18n/recurrence to /static/jsi18n/recurrence

Not sure how to fix that...