#10840: URL fetching for AJAX libraries
---------------------------------------------+------------------------------
Reporter: mathijs | Owner: nobody
Status: new | Milestone:
Component: Generic views | Version: SVN
Resolution: | Keywords: ajax url generic
fetch
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by mathijs):
@qingfeng, you've missed my point here, you still hard-coding the url
/demo/ajax1/ in your template, plus your tag results in in-line javascript
tags, which I personnaly loath, plus it is far from toolkit-independent.
@russellm:
What I'm talking about is a view returning a JSON object looking something
like this:
{
"named_javascript_view1": "/url_to/named_view1/",
"named_javascript_view2": "/url_to/named_view2/"
}
There are however two use-cases to think about. We can have static urls
(no parameters in it) and dynamic urls. You can load the static urls once
and cache them in an array (e.g. views["named_javascript_view1"]), the
dynamic ones can either be fetched on-demand, or we can use regular
expressions in the Javascript file. The last option seems better, as long
as there's no problem with security.
This generic view would thus load the urls file, parse it and send all
named views as a JSON response. The achievement would be that AJAX
requests no longer need hard-coded urls.
It would be similar to the i18n extensions because you would still need to
include the url yourself in the urls file. This implementation does not
require changes to the existing code base, and is as such completely
modular, in accordance with Django's philosophy.
--
Ticket URL: <http://code.djangoproject.com/ticket/10840#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---