|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
[Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #10840: URL fetching for AJAX libraries
------------------------------------+--------------------------------------- Reporter: mathijs | Owner: nobody Status: new | Milestone: 1.2 Component: Generic views | Version: SVN Keywords: ajax url generic fetch | Stage: Unreviewed Has_patch: 0 | ------------------------------------+--------------------------------------- When developing AJAX add-ons for my Django apps, they often need to post data on a specific url. Most of the time I'm forced to hard code this url into my scripts. However, if it would be possible to have a single url (read: view) that fetches the url for a given view name + variables, or returns an array of the sort: ["view_name" => "/user_%(id)/...", ...] (the %(id) part should than be replaced with the correct parameters), AJAX scripts can become more url-abstract. My request is a generic view that works as explained above, you could then enable it by adding one more URL to your url.py file pointing to this generic view. Comparable to what we have for i18n for AJAX. Some generic javascript code would also be needed to handle the parsing of the array (using caching etc). If you are interested in including such a feauture in trunk, I'd even be willing to write up some code. regards, Mathijs -- Ticket URL: <http://code.djangoproject.com/ticket/10840> 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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #10840: URL fetching for AJAX libraries
---------------------------------------------+------------------------------ Reporter: mathijs | Owner: nobody Status: new | Milestone: 1.2 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 | ---------------------------------------------+------------------------------ Changes (by anonymous): * needs_better_patch: => 0 * stage: Unreviewed => Design decision needed * needs_tests: => 0 * needs_docs: => 0 -- Ticket URL: <http://code.djangoproject.com/ticket/10840#comment:1> 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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #10840: URL fetching for AJAX libraries
---------------------------------------------+------------------------------ Reporter: mathijs | Owner: nobody Status: new | Milestone: 1.2 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 | ---------------------------------------------+------------------------------ Changes (by qingfeng): * cc: qingfeng@... (added) Comment: Look here :) Django Ajax Tag, ROR link_to_remote clone. {{{ {% ajax %} link_to_remote url => /demo/ajax1/ update => #ajax1 success => $("#ajax1").css("color","red") {% endajax %} }}} http://github.com/qingfeng/django-ajax-tag/tree/master http://github.com/qingfeng/django-ajax- tag/blob/bc8bc075fecc1799bea99ec18bc03c0fef282010/demo/templates/demo.html -- Ticket URL: <http://code.djangoproject.com/ticket/10840#comment:2> 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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #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 | ---------------------------------------------+------------------------------ Changes (by russellm): * milestone: 1.2 => Comment: I'm having difficulty understanding what you're proposing here. Could you clarify exactly what it is that this view is for, and what it will acheive? Providing some sample code to demonstrate how it would be used would be a good start. -- Ticket URL: <http://code.djangoproject.com/ticket/10840#comment:3> 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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #10840: URL fetching for AJAX libraries
by Django-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #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 mlouro): I don't think a generic view is ideal for this, since it would require one ajax call to the server to retrieve urls. I have built a simple command (dump_urls) that outputs a JS Object Literal with view names and urls that I think is a good start for something like this, and a better approach design wise. It lives @ http://github.com/mlouro/django-extensions for now Example output: { "task_ajax_complete": "/projects/<project_id>/task/ajax/complete/<task_id>/", "task_ajax_remove": "/projects/<project_id>/task/ajax/remove_task/", "task_delete": "/projects/<project_id>/task/delete/<task_id>/", "task_detail": "/projects/<project_id>/task/<task_id>/", "task_edit": "/projects/<project_id>/task/save/<task_id>/", "task_index": "/projects/<project_id>/task/", "time_add": "/projects/<project_id>/time/save/", "time_delete": "/projects/<project_id>/time/delete/<time_id>/", "time_edit": "/projects/<project_id>/time/save/<time_id>/", "time_index": "/projects/<project_id>/time/" } -- Ticket URL: <http://code.djangoproject.com/ticket/10840#comment:5> 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 django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |