Opened 14 years ago
Last modified 10 days ago
#12264 new New feature
calendar.js depends on jsi18n but date widgets using it do not specify as required media
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.1 |
Severity: | Normal | Keywords: | |
Cc: | Adam Zapletal | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Its nice that we can just use the admin widgets in our own public forms - except trying to include the split date/time widget results in a need for gettext which is in the jsi18n package which requires a separate urlconf entry and view to pull into my app. This is messy. Dependent code should automatically pull in its dependencies.
Change History (5)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 13 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:3 by , 13 years ago
Easy pickings: | unset |
---|---|
Type: | Bug → New feature |
comment:5 by , 10 days ago
Cc: | added |
---|
It looks like this is still valid. Supporting this idea doesn't seem very straightforward given the dynamic nature of django/views/templates/i18n_catalog.js
. I agree with the comment above that it's ok if a user wanting to use admin-specific widgets that aren't designed to be used outside of the admin may have to do a bit of extra integration work.
If a user wants to use the widgets without internationalization, they should be able to define simple JavaScript stubs for gettext
, pgettext
, and get_format
to get things working. If they want to use internationalization, I feel like having to do the same kind of integration that the admin does is acceptable.
Considering the above, does this bit of the docs on form media seem misleading? https://github.com/django/django/blob/73df8b54a2fab53bec4c7573cda5ad8c869c2fd8/docs/topics/forms/media.txt#L21-L32
IMHO being able to reuse admin widgets in out own apps isn't parr of the design objectives of thes widgets. I think being able to achieve that should be possible but the developer needs to perform all the steps needed for the integration, just like with any other front end component. I particularly don't like at all having to devise a way to magically add a view like the one serving the jsi18n catalog to the URL map of the third party app.