Re: Ajax, jQuery and Django

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices. Reply or send
email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Mon, 5 Oct 2020, 1:33 pm Salima Begum, 
wrote:

> Hi all,
> I have database of zip code for example,
> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
> (1, '00501', 'Holtsville', 'NY'),
> (2, '00544', 'Holtsville', 'NY'),
> (3, '00601', 'Adjuntas', 'PR'),
> (4, '00602', 'Aguada', 'PR'),
> (5, '00603', 'Aguadilla', 'PR'),
> (6, '00604', 'Aguadilla', 'PR'),
> (7, '00605', 'Aguadilla', 'PR'),
> (8, '00606', 'Maricao', 'PR'),
> (9, '00610', 'Anasco', 'PR'),
> (10, '00611', 'Angeles', 'PR'),
> (11, '00612', 'Arecibo', 'PR'),
> (12, '00613', 'Arecibo', 'PR'),
> (13, '00614', 'Arecibo', 'PR'),
> (14, '00616', 'Bajadero', 'PR'),
> (15, '00617', 'Barceloneta', 'PR'),
> (16, '00622', 'Boqueron', 'PR'),
> (17, '00623', 'Cabo Rojo', 'PR'),
> (18, '00624', 'Penuelas', 'PR'),
> (19, '00627', 'Camuy', 'PR');
> If user enters zipcode, Then state and city column should be auto fill by
> using database of zip code in django and jQuery .
> Please let me know how to do this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DM-_czipdp%2BpcfE6ytaweJe6Dw_ZCie4n4-VY-ZakLjg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH9mneVbuRMs8e8gt-4EUW_if_X2tOqJj9w9Lj8pD1iZi%3DX-FA%40mail.gmail.com.


Re: Ajax, jQuery and Django

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices. Reply or send
email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Mon, 5 Oct 2020, 1:35 pm Salima Begum, 
wrote:

> Hi all,
> I have database of zip code for example,
> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
> (1, '00501', 'Holtsville', 'NY'),
> (2, '00544', 'Holtsville', 'NY'),
> (3, '00601', 'Adjuntas', 'PR'),
> (4, '00602', 'Aguada', 'PR'),
> (5, '00603', 'Aguadilla', 'PR'),
> (6, '00604', 'Aguadilla', 'PR'),
> (7, '00605', 'Aguadilla', 'PR'),
> (8, '00606', 'Maricao', 'PR'),
> (9, '00610', 'Anasco', 'PR'),
> (10, '00611', 'Angeles', 'PR'),
> (11, '00612', 'Arecibo', 'PR'),
> (12, '00613', 'Arecibo', 'PR'),
> (13, '00614', 'Arecibo', 'PR'),
> (14, '00616', 'Bajadero', 'PR'),
> (15, '00617', 'Barceloneta', 'PR'),
> (16, '00622', 'Boqueron', 'PR'),
> (17, '00623', 'Cabo Rojo', 'PR'),
> (18, '00624', 'Penuelas', 'PR'),
> (19, '00627', 'Camuy', 'PR');
> If user enters zipcode, Then state and city column should be auto fill by
> using database of zip code in django and jQuery .
> Please let me know how to do this.
>
> Thank You,
> ~Salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH9mneVLY6Vvx%2BFh-VxEpQFX2%2BgS%2BKYs76t5aak9VxcvkrQDpg%40mail.gmail.com.


Re: Ajax, jQuery and Django

2020-10-05 Thread Eugene TUYIZERE
https://simpleisbetterthancomplex.com/tutorial/2018/01/29/how-to-implement-dependent-or-chained-dropdown-list-with-django.html

check this also

On Mon, 5 Oct 2020 at 11:25, RANGA BHARATH JINKA 
wrote:

> Hi,
>
> Check this. This may be useful for you.
>
> All the best
>
>
> https://www.youtube.com/results?search_query=django+dependent+drop+down+list+from+database
>
> On Mon, Oct 5, 2020 at 1:56 PM Kunal Solanke 
> wrote:
>
>> Rather than sending ajax every time handle it on frontend in javascript
>>
>> On Mon, Oct 5, 2020, 13:35 Salima Begum 
>> wrote:
>>
>>> Hi all,
>>> I have database of zip code for example,
>>> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
>>> (1, '00501', 'Holtsville', 'NY'),
>>> (2, '00544', 'Holtsville', 'NY'),
>>> (3, '00601', 'Adjuntas', 'PR'),
>>> (4, '00602', 'Aguada', 'PR'),
>>> (5, '00603', 'Aguadilla', 'PR'),
>>> (6, '00604', 'Aguadilla', 'PR'),
>>> (7, '00605', 'Aguadilla', 'PR'),
>>> (8, '00606', 'Maricao', 'PR'),
>>> (9, '00610', 'Anasco', 'PR'),
>>> (10, '00611', 'Angeles', 'PR'),
>>> (11, '00612', 'Arecibo', 'PR'),
>>> (12, '00613', 'Arecibo', 'PR'),
>>> (13, '00614', 'Arecibo', 'PR'),
>>> (14, '00616', 'Bajadero', 'PR'),
>>> (15, '00617', 'Barceloneta', 'PR'),
>>> (16, '00622', 'Boqueron', 'PR'),
>>> (17, '00623', 'Cabo Rojo', 'PR'),
>>> (18, '00624', 'Penuelas', 'PR'),
>>> (19, '00627', 'Camuy', 'PR');
>>> If user enters zipcode, Then state and city column should be auto fill
>>> by using database of zip code in django and jQuery .
>>> Please let me know how to do this.
>>>
>>> Thank You,
>>> ~Salima
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAOecAny6XS%2B7wrvTDbEDdVOwC76Umv02nQ4AxnDeEwXUAArMUA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAK5m316JmU0i_CkUMkUE93VwAN-cyTGSMAPBMxDg%2BJ6OcLSG-Q%40mail.gmail.com
> 
> .
>


-- 
*TUYIZERE Eugene*



*Msc Degree in Mathematical Science*

*African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
Garden-Lime, Cameroon*

Bsc in Computer Science

*UR-Nyagatare Campus*

Email: eugene.tuyiz...@aims-cameroon.org
   eugenetuyiz...@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABxpZHsFBQ8vZEW%3DpVZc41b8gGm8Rnoi00BQEoQw2ZEqEUkCAg%40mail.gmail.com.


Re: Ajax, jQuery and Django

2020-10-05 Thread RANGA BHARATH JINKA
Hi,

Check this. This may be useful for you.

All the best

https://www.youtube.com/results?search_query=django+dependent+drop+down+list+from+database

On Mon, Oct 5, 2020 at 1:56 PM Kunal Solanke 
wrote:

> Rather than sending ajax every time handle it on frontend in javascript
>
> On Mon, Oct 5, 2020, 13:35 Salima Begum 
> wrote:
>
>> Hi all,
>> I have database of zip code for example,
>> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
>> (1, '00501', 'Holtsville', 'NY'),
>> (2, '00544', 'Holtsville', 'NY'),
>> (3, '00601', 'Adjuntas', 'PR'),
>> (4, '00602', 'Aguada', 'PR'),
>> (5, '00603', 'Aguadilla', 'PR'),
>> (6, '00604', 'Aguadilla', 'PR'),
>> (7, '00605', 'Aguadilla', 'PR'),
>> (8, '00606', 'Maricao', 'PR'),
>> (9, '00610', 'Anasco', 'PR'),
>> (10, '00611', 'Angeles', 'PR'),
>> (11, '00612', 'Arecibo', 'PR'),
>> (12, '00613', 'Arecibo', 'PR'),
>> (13, '00614', 'Arecibo', 'PR'),
>> (14, '00616', 'Bajadero', 'PR'),
>> (15, '00617', 'Barceloneta', 'PR'),
>> (16, '00622', 'Boqueron', 'PR'),
>> (17, '00623', 'Cabo Rojo', 'PR'),
>> (18, '00624', 'Penuelas', 'PR'),
>> (19, '00627', 'Camuy', 'PR');
>> If user enters zipcode, Then state and city column should be auto fill by
>> using database of zip code in django and jQuery .
>> Please let me know how to do this.
>>
>> Thank You,
>> ~Salima
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOecAny6XS%2B7wrvTDbEDdVOwC76Umv02nQ4AxnDeEwXUAArMUA%40mail.gmail.com
> 
> .
>


-- 
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK5m316JmU0i_CkUMkUE93VwAN-cyTGSMAPBMxDg%2BJ6OcLSG-Q%40mail.gmail.com.


Re: Ajax, jQuery and Django

2020-10-05 Thread Kunal Solanke
Rather than sending ajax every time handle it on frontend in javascript

On Mon, Oct 5, 2020, 13:35 Salima Begum 
wrote:

> Hi all,
> I have database of zip code for example,
> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
> (1, '00501', 'Holtsville', 'NY'),
> (2, '00544', 'Holtsville', 'NY'),
> (3, '00601', 'Adjuntas', 'PR'),
> (4, '00602', 'Aguada', 'PR'),
> (5, '00603', 'Aguadilla', 'PR'),
> (6, '00604', 'Aguadilla', 'PR'),
> (7, '00605', 'Aguadilla', 'PR'),
> (8, '00606', 'Maricao', 'PR'),
> (9, '00610', 'Anasco', 'PR'),
> (10, '00611', 'Angeles', 'PR'),
> (11, '00612', 'Arecibo', 'PR'),
> (12, '00613', 'Arecibo', 'PR'),
> (13, '00614', 'Arecibo', 'PR'),
> (14, '00616', 'Bajadero', 'PR'),
> (15, '00617', 'Barceloneta', 'PR'),
> (16, '00622', 'Boqueron', 'PR'),
> (17, '00623', 'Cabo Rojo', 'PR'),
> (18, '00624', 'Penuelas', 'PR'),
> (19, '00627', 'Camuy', 'PR');
> If user enters zipcode, Then state and city column should be auto fill by
> using database of zip code in django and jQuery .
> Please let me know how to do this.
>
> Thank You,
> ~Salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOecAny6XS%2B7wrvTDbEDdVOwC76Umv02nQ4AxnDeEwXUAArMUA%40mail.gmail.com.


Ajax, jQuery and Django

2020-10-05 Thread Salima Begum
Hi all,
I have database of zip code for example,
INSERT INTO pages_zip_code (id, zip, city, st) VALUES
(1, '00501', 'Holtsville', 'NY'),
(2, '00544', 'Holtsville', 'NY'),
(3, '00601', 'Adjuntas', 'PR'),
(4, '00602', 'Aguada', 'PR'),
(5, '00603', 'Aguadilla', 'PR'),
(6, '00604', 'Aguadilla', 'PR'),
(7, '00605', 'Aguadilla', 'PR'),
(8, '00606', 'Maricao', 'PR'),
(9, '00610', 'Anasco', 'PR'),
(10, '00611', 'Angeles', 'PR'),
(11, '00612', 'Arecibo', 'PR'),
(12, '00613', 'Arecibo', 'PR'),
(13, '00614', 'Arecibo', 'PR'),
(14, '00616', 'Bajadero', 'PR'),
(15, '00617', 'Barceloneta', 'PR'),
(16, '00622', 'Boqueron', 'PR'),
(17, '00623', 'Cabo Rojo', 'PR'),
(18, '00624', 'Penuelas', 'PR'),
(19, '00627', 'Camuy', 'PR');
If user enters zipcode, Then state and city column should be auto fill by
using database of zip code in django and jQuery .
Please let me know how to do this.

Thank You,
~Salima

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DceNs7rk3zY4aNAS2MpUtAnamPi%2BzsfBx5maK9NZPo%2Bw%40mail.gmail.com.


Ajax, jQuery and Django

2020-10-05 Thread Salima Begum
Hi all,
I have database of zip code for example,
INSERT INTO pages_zip_code (id, zip, city, st) VALUES
(1, '00501', 'Holtsville', 'NY'),
(2, '00544', 'Holtsville', 'NY'),
(3, '00601', 'Adjuntas', 'PR'),
(4, '00602', 'Aguada', 'PR'),
(5, '00603', 'Aguadilla', 'PR'),
(6, '00604', 'Aguadilla', 'PR'),
(7, '00605', 'Aguadilla', 'PR'),
(8, '00606', 'Maricao', 'PR'),
(9, '00610', 'Anasco', 'PR'),
(10, '00611', 'Angeles', 'PR'),
(11, '00612', 'Arecibo', 'PR'),
(12, '00613', 'Arecibo', 'PR'),
(13, '00614', 'Arecibo', 'PR'),
(14, '00616', 'Bajadero', 'PR'),
(15, '00617', 'Barceloneta', 'PR'),
(16, '00622', 'Boqueron', 'PR'),
(17, '00623', 'Cabo Rojo', 'PR'),
(18, '00624', 'Penuelas', 'PR'),
(19, '00627', 'Camuy', 'PR');
If user enters zipcode, Then state and city column should be auto fill by
using database of zip code in django and jQuery .
Please let me know how to do this

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMSz6b%3DM-_czipdp%2BpcfE6ytaweJe6Dw_ZCie4n4-VY-ZakLjg%40mail.gmail.com.


Re: Django +Ajax + jQuery problem

2020-07-03 Thread Andréas Kühne
Hi,

The reason for this is that you are replacing the buttons when you update
the answer. The event listener that you attached is on the first one and
not the second one.
You can solve this in 2 ways:

1. Reregister the event listener when you have loaded the answer again.
2. Use a different way to add the event listeners in the first place. You
can register it this way instead: $('body').on('click', '.upvote',
function() {});

Regards,

Andréas


Den tors 2 juli 2020 kl 19:16 skrev Jan Gregorczyk :

> My problem is that site registers only the first click on .upvote or
> .downvote element and ignores next ones.
> {% extends 'base.html' %}
> {% load votes_exists %}
> {% block title %}{{question.title|truncatechars:52}}{% endblock %}
> {% block content %}
> {{question.title}}
> {{question.content}}
> {% for answer in question.answers.all %}
> {{answer.author}}
> {{answer.content}}
>
> 
> {% votes_up_exists answer request.user.id as is_upvoted %}
> {% votes_down_exists answer request.user.id as is_downvoted %}
> ↑
> {{answer.vote_score}}
> ↓
> 
> {% endfor %}
> 
> {% csrf_token %}
> {{form.as_p}}
> 
> 
> {% endblock %}
> {% block javascript %}
> {% load static %}
> https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js";>
> 
> //upvote and downvote script
> var csrftoken = window.Cookies.get('csrftoken');
> function csrfSafeMethod(method) {
> // these HTTP methods do not require CSRF protection
> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> }
> $.ajaxSetup({
> beforeSend: function(xhr, settings) {
> if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
> xhr.setRequestHeader("X-CSRFToken", csrftoken);
> }
> }
> });
> $(".upvote").click( function() {
> let answerid = $(this).data("answer-id");
> $.post("{% url 'upvote' %}", {answer_id:answerid}, function(response) {
> /*$("#score-" + answerid).load(window.location.href + " " + "#score-" +
> answerid);
> $("#upvote-" + answerid).load(window.location.href + " " + "#upvote-" +
> answerid);
> $("#downvote-" + answerid).load(window.location.href + " " + "#downvote-"
> + answerid);*/
> $("#answer-" + answerid).load(window.location.href + " " + "#answer-" +
> answerid);
> alert(response);
> });
> });
> $(".downvote").click( function() {
> let answerid = $(this).data("answer-id");
> $.post("{% url 'downvote' %}", {answer_id:answerid}, function(response) {
> /*
> $("#score-" + answerid).load(window.location.href + " " + "#score-" +
> answerid);
> $("#upvote-" + answerid).load(window.location.href + " " + "#upvote-" +
> answerid);
> $("#downvote-" + answerid).load(window.location.href + " " + "#downvote-"
> + answerid);*/
> $("#answer-" + answerid).load(window.location.href + " " + "#answer-" +
> answerid);
> alert(response);
> });
> });
> 
> {% endblock %}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFyHfE3_EogRCb-2xvGpS6ACDNPbF_JxBLzsfD%3D2XLoBKsJysA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCeOLmLxGDSQuEzCN51Pr6%2BRWfwNc8UqvrAAsj_JMQFWEw%40mail.gmail.com.


Django +Ajax + jQuery problem

2020-07-02 Thread Jan Gregorczyk
My problem is that site registers only the first click on .upvote or
.downvote element and ignores next ones.
{% extends 'base.html' %}
{% load votes_exists %}
{% block title %}{{question.title|truncatechars:52}}{% endblock %}
{% block content %}
{{question.title}}
{{question.content}}
{% for answer in question.answers.all %}
{{answer.author}}
{{answer.content}}


{% votes_up_exists answer request.user.id as is_upvoted %}
{% votes_down_exists answer request.user.id as is_downvoted %}
↑
{{answer.vote_score}}
↓

{% endfor %}

{% csrf_token %}
{{form.as_p}}


{% endblock %}
{% block javascript %}
{% load static %}
https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js
">

//upvote and downvote script
var csrftoken = window.Cookies.get('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});
$(".upvote").click( function() {
let answerid = $(this).data("answer-id");
$.post("{% url 'upvote' %}", {answer_id:answerid}, function(response) {
/*$("#score-" + answerid).load(window.location.href + " " + "#score-" +
answerid);
$("#upvote-" + answerid).load(window.location.href + " " + "#upvote-" +
answerid);
$("#downvote-" + answerid).load(window.location.href + " " + "#downvote-" +
answerid);*/
$("#answer-" + answerid).load(window.location.href + " " + "#answer-" +
answerid);
alert(response);
});
});
$(".downvote").click( function() {
let answerid = $(this).data("answer-id");
$.post("{% url 'downvote' %}", {answer_id:answerid}, function(response) {
/*
$("#score-" + answerid).load(window.location.href + " " + "#score-" +
answerid);
$("#upvote-" + answerid).load(window.location.href + " " + "#upvote-" +
answerid);
$("#downvote-" + answerid).load(window.location.href + " " + "#downvote-" +
answerid);*/
$("#answer-" + answerid).load(window.location.href + " " + "#answer-" +
answerid);
alert(response);
});
});

{% endblock %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFyHfE3_EogRCb-2xvGpS6ACDNPbF_JxBLzsfD%3D2XLoBKsJysA%40mail.gmail.com.


django dependent drop down list without using javascript; ajax; jquery

2020-04-11 Thread Mayank Tripathi
Hi All,

Could any one please share some details on how we can do dependent drop 
down list selection.
I am seeing lot of videos or content to handle this via JavaScript; AJAX; 
jquery etc.. but just wondering if Django has anything which can be handled 
easily.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d0ab688-2f10-4380-b14d-c622ae5fa9fc%40googlegroups.com.


Re: Multiple image upload in Django using AJAX & jQuery

2018-06-22 Thread Jani Tiainen
I've made simple picture uploader with Django. Sources can be found at
https://github.com/jtiai/picpaster

pe 22. kesäk. 2018 klo 14.38 Keerthan Bhat  kirjoitti:

> Can someone please help me in this? This thing is literally giving me
> headache from past few weeks. Please help. Please!
>
>
> https://stackoverflow.com/questions/50982220/multiple-image-upload-in-django-using-ajax-jquery
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/133c6dea-e46a-43ca-a92c-bb1d339fa513%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/133c6dea-e46a-43ca-a92c-bb1d339fa513%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocr%3DUktKeDSEXHDnZxy97ftVpw1K75wmp%3DsOAf1r37ZRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Multiple image upload in Django using AJAX & jQuery

2018-06-22 Thread Keerthan Bhat
Can someone please help me in this? This thing is literally giving me 
headache from past few weeks. Please help. Please!

https://stackoverflow.com/questions/50982220/multiple-image-upload-in-django-using-ajax-jquery

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/133c6dea-e46a-43ca-a92c-bb1d339fa513%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and AJAX jQuery

2014-09-01 Thread Martin Spasov
Perfect, thank you

On 9/1/14, Collin Anderson  wrote:
> If the url name is not guessable (for example, it includes a secure random
> string, like django's forgot password url), that should provide enough
> security.
>
> Though you can always pass in the csrf token using javascript:
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/5qrRk3by4z4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1a8bdb6a-8ed1-4e23-b56d-bd222d34471a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMy4o4Fc%3D9YrE7%2BBZ%2Bk27Ps9d8co%3D-CTWXxiAykjsZxee9aSYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django and AJAX jQuery

2014-09-01 Thread Collin Anderson
If the url name is not guessable (for example, it includes a secure random 
string, like django's forgot password url), that should provide enough 
security.

Though you can always pass in the csrf token using javascript:
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1a8bdb6a-8ed1-4e23-b56d-bd222d34471a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django and AJAX jQuery

2014-09-01 Thread Martin Spasov
I am completely new to AJAX and I was wondering. I have a a view that  ajax 
is posting to but in order for the request to be processed in the view 
correctly i have to add csrf_exempt decorator to that view, but is that 
safe? I named the url for that view with a name that would not be 
guessable, but still ?

Thanks!
Martin!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/24a200f5-c313-47f5-99a9-314151548ad5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: response to ajax (jquery) with variables

2014-08-31 Thread Antonio Russoniello

Thank you Andreas ... I got it !!!

AR

El 30/08/2014 05:04 a.m., Andreas Kuhne escribió:

Hi again Antonio,

First of all, make sure you are using a good browser with debugging 
capabilities (I prefer Chrome), because you'll need it.


Secondly, I usually use the $.ajax request, instead of the post. 
Mainly because post is a wrapper around ajax and you can more finely 
change the settings of ajax.


So the post in your case would be:

$.ajax({
type: 'POST',   // Make sure you post
dataType: 'json',  // Use this so that you request json 
from the server

url: "/sitioweb/json/",
data: data,
success: function(data) {
// The data that is returned is your json data, already 
parser, so you don't have to parse it!
alert(data.array[0]); // Need to write "array" because 
that is what you are sending to the browser (your structure looks like 
that, check what the server is responding with)

},
error: function(xhr, textStatus, errorThrown) {
console.log('AJAX communication failed:', textStatus, 
errorThrown);// In case there is an error (for example a 500)

}
});

Regards,

Andréas

2014-08-30 4:57 GMT+02:00 Antonio Russoniello 
mailto:aruss...@musicparticles.com>>:


Now I can read data from  ajax to my def but I have not idea to
how send, for examle, an array to jquery and manage this from
javascript...

I tried:

def json_prueba(request):
arrg = [1,2,3,4]
if request.method == 'POST':
return HttpResponse(simplejson.dumps({'array': arrg}),
content_type="application/json")
return HttpResponse('FAIL!')

from the page side:

function updateDB(){
$.post("/sitioweb/json/", data, function(response){
if(response){
var data = JSON.parse(*response*); <- NOT
SURE IF THIS IS CORRECT
alert(data[0]); }  <- I´m trying
to put on an alert windows the first item of my array arrg
else{ alert('Error! :(');}
});
}

Thanks in advande.

AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to
set the content_type, otherwise the client can get confused.

Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello
mailto:aruss...@musicparticles.com>>:

Hello,

i hope you can help me with this, I'm trying to send to an
ajax (jquery from my html template) a response but i would
like to send also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE
TO SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
You received this message because you are subscribed to the

Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email&utm_source=footer>.
For more options, visit ht

Re: response to ajax (jquery) with variables

2014-08-30 Thread Andreas Kuhne
Hi again Antonio,

First of all, make sure you are using a good browser with debugging
capabilities (I prefer Chrome), because you'll need it.

Secondly, I usually use the $.ajax request, instead of the post. Mainly
because post is a wrapper around ajax and you can more finely change the
settings of ajax.

So the post in your case would be:

$.ajax({
type: 'POST',   // Make sure you post
dataType: 'json',  // Use this so that you request json from
the server
url: "/sitioweb/json/",
data: data,
success: function(data) {
// The data that is returned is your json data, already parser, so
you don't have to parse it!
alert(data.array[0]); // Need to write "array" because that is
what you are sending to the browser (your structure looks like that, check
what the server is responding with)
},
error: function(xhr, textStatus, errorThrown) {
console.log('AJAX communication failed:', textStatus, errorThrown);
   // In case there is an error (for example a 500)
}
});

Regards,

Andréas

2014-08-30 4:57 GMT+02:00 Antonio Russoniello :

>  Now I can read data from  ajax to my def but I have not idea to how send,
> for examle, an array to jquery and manage this from javascript...
>
> I tried:
>
> def json_prueba(request):
> arrg = [1,2,3,4]
> if request.method == 'POST':
> return HttpResponse(simplejson.dumps({'array': arrg}),
> content_type="application/json")
> return HttpResponse('FAIL!')
>
> from the page side:
>
> function updateDB(){
> $.post("/sitioweb/json/", data, function(response){
> if(response){
> var data = JSON.parse(*response*); <- NOT SURE IF
> THIS IS CORRECT
> alert(data[0]); }  <- I´m trying to put on
> an alert windows the first item of my array arrg
> else{ alert('Error! :(');}
> });
> }
>
> Thanks in advande.
>
> AR
>
>
> El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:
>
> Hi Antonio,
>
>  import simplejson as json
>
>  return HttpResponse(
>  json.dumps({
> 'array': example
> }),
>  content_type="application/json"
> )
>
>  That would do the trick. This is returned as JSON. Remember to set the
> content_type, otherwise the client can get confused.
>
>  Regards,
>
>  Andréas
>
> 2014-08-28 2:56 GMT+02:00 Antonio Russoniello  >:
>
>>  Hello,
>>
>> i hope you can help me with this, I'm trying to send to an ajax (jquery
>> from my html template) a response but i would like to send also a new
>> variable.
>>
>> in my html template I have:
>>
>> $("#init_date").click(function(){
>> var some_date = {'init_date': init_date, 'end_date': end_date};
>> $.post("/filter_dates/", some_date, function(response){
>> if(response === 'success'){
>> *MAKE SOMETHING**!!!*
>> else{ alert('error'); }
>> });
>> });
>>
>> my django view look like:
>>
>> def filter_date(request):
>> if request.method == 'POST':
>> example = ['A','B','C']
>> init_date = request.POST['init_date']
>> end_date = request.POST['end_date']
>>  MAKE SOMETHING!!
>> return HttpResponse('success') *AND HERE I WOULD LIKE TO SEND
>> THE example ARRAY...*
>> else:
>> return HttpResponse('error')
>>
>> How can I send the array o some other variable as response?
>>
>> Regards,
>> AR
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com
>> <https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google G

Re: response to ajax (jquery) with variables

2014-08-29 Thread Antonio Russoniello
Now I can read data from  ajax to my def but I have not idea to how 
send, for examle, an array to jquery and manage this from javascript...


I tried:

def json_prueba(request):
arrg = [1,2,3,4]
if request.method == 'POST':
return HttpResponse(simplejson.dumps({'array': arrg}), 
content_type="application/json")

return HttpResponse('FAIL!')

from the page side:

function updateDB(){
$.post("/sitioweb/json/", data, function(response){
if(response){
var data = JSON.parse(*response*); <- NOT SURE 
IF THIS IS CORRECT
alert(data[0]); }  <- I´m trying to put 
on an alert windows the first item of my array arrg

else{ alert('Error! :(');}
});
}

Thanks in advande.
AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to set the 
content_type, otherwise the client can get confused.


Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello 
mailto:aruss...@musicparticles.com>>:


Hello,

i hope you can help me with this, I'm trying to send to an ajax
(jquery from my html template) a response but i would like to send
also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO
SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto:django-users@googlegroups.com>.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54013DA3.3090901%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: response to ajax (jquery) with variables

2014-08-29 Thread Antonio Russoniello

Thanks Andréas,

I will try it.

Regards/AR


El 28/08/2014 02:57 a.m., Andreas Kuhne escribió:

Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to set the 
content_type, otherwise the client can get confused.


Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello 
mailto:aruss...@musicparticles.com>>:


Hello,

i hope you can help me with this, I'm trying to send to an ajax
(jquery from my html template) a response but i would like to send
also a new variable.

in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date':
end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO
SEND THE example ARRAY.../
else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR
-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com

<https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto:django-users@googlegroups.com>.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/540136FE.9000809%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: response to ajax (jquery) with variables

2014-08-28 Thread Andreas Kuhne
Hi Antonio,

import simplejson as json

return HttpResponse(
json.dumps({
'array': example
}),
content_type="application/json"
)

That would do the trick. This is returned as JSON. Remember to set the
content_type, otherwise the client can get confused.

Regards,

Andréas

2014-08-28 2:56 GMT+02:00 Antonio Russoniello :

>  Hello,
>
> i hope you can help me with this, I'm trying to send to an ajax (jquery
> from my html template) a response but i would like to send also a new
> variable.
>
> in my html template I have:
>
> $("#init_date").click(function(){
> var some_date = {'init_date': init_date, 'end_date': end_date};
> $.post("/filter_dates/", some_date, function(response){
> if(response === 'success'){
> *MAKE SOMETHING**!!!*
> else{ alert('error'); }
> });
> });
>
> my django view look like:
>
> def filter_date(request):
> if request.method == 'POST':
> example = ['A','B','C']
> init_date = request.POST['init_date']
> end_date = request.POST['end_date']
>  MAKE SOMETHING!!
> return HttpResponse('success') *AND HERE I WOULD LIKE TO SEND THE
> example ARRAY...*
> else:
> return HttpResponse('error')
>
> How can I send the array o some other variable as response?
>
> Regards,
> AR
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com
> <https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbnxRG8cs7_4-ALJUubXRPhx%2B2FQE1NA7bkTiBqoB1ySLw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


response to ajax (jquery) with variables

2014-08-27 Thread Antonio Russoniello

Hello,

i hope you can help me with this, I'm trying to send to an ajax (jquery 
from my html template) a response but i would like to send also a new 
variable.


in my html template I have:

$("#init_date").click(function(){
var some_date = {'init_date': init_date, 'end_date': end_date};
$.post("/filter_dates/", some_date, function(response){
if(response === 'success'){
/MAKE SOMETHING//!!!/
else{ alert('error'); }
});
});

my django view look like:

def filter_date(request):
if request.method == 'POST':
example = ['A','B','C']
init_date = request.POST['init_date']
end_date = request.POST['end_date']
 MAKE SOMETHING!!
return HttpResponse('success') /AND HERE I WOULD LIKE TO SEND 
THE example ARRAY.../

else:
return HttpResponse('error')

How can I send the array o some other variable as response?

Regards,
AR

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53FE7E44.4020104%40musicparticles.com.
For more options, visit https://groups.google.com/d/optout.


Re: django ajax jquery

2013-08-15 Thread carlos
Hi
maybe you need find in google.com for example


http://fromzerotocodehero.blogspot.com/2011/01/django-ajax-tutorial-part-1.html

I think there are more tutorials

Cheers,


On Thu, Aug 15, 2013 at 6:09 AM, Scheck Nyori  wrote:

> Hello!
> I am a noob in web development. Just finished polls tuts. Can anyone give
> me any insight in using jquery and ajax with django! If possible any
> tutorial. Any help will be appreciated!
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


django ajax jquery

2013-08-15 Thread Scheck Nyori
Hello!
I am a noob in web development. Just finished polls tuts. Can anyone give
me any insight in using jquery and ajax with django! If possible any
tutorial. Any help will be appreciated!
Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Django+Ajax+jquery

2012-08-03 Thread Rishabh Dixit
Someone please give some solution to this stack overflow question-

http://stackoverflow.com/questions/11706721/updating-a-button-value-database-and-call-a-view-function-without-refreshing-th

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/TsUurybMHq8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ajax/jquery .load() unresponsive via django html templating, or FF/chrome

2012-03-20 Thread Eli_West
Thanks, I think I did read the page that recommends adding a script
and did so but no help there. I'll doublecheck but it just seems like
there is not very much info on this topic.

Is it safe to say that somehow having django templating in the middle
is causing xss issues to0? Extra content from .load() is still coming
from localhost so I can't see how it would blocked.

thx

On Mar 20, 4:26 am, Tom Evans  wrote:
> On Mon, Mar 19, 2012 at 6:52 AM, Eli_West  wrote:
> > 2 potential issues I've been trying solve:
>
> > 1) Django csrf or other mechanism is blocking ajax and jquery .load()
>
> > […]
>
> Are you following the advice laid out in the Django manual on AJAX And CSRF?
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Ajax/jquery .load() unresponsive via django html templating, or FF/chrome

2012-03-20 Thread Tom Evans
On Mon, Mar 19, 2012 at 6:52 AM, Eli_West  wrote:
> 2 potential issues I've been trying solve:
>
> 1) Django csrf or other mechanism is blocking ajax and jquery .load()
>
> […]

Are you following the advice laid out in the Django manual on AJAX And CSRF?

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Ajax/jquery .load() unresponsive via django html templating, or FF/chrome

2012-03-18 Thread Eli_West
2 potential issues I've been trying solve:

1) Django csrf or other mechanism is blocking ajax and jquery .load()

   This following simple ajax interaction works by opening directly in
a browser, but not through a django view:
  ( assume content to load from namesinfo.htm is available)

javascript
$(document).ready(function() {
$('.list').click(function () {
$('#message').load('namesinfo.htm li');
return false;
});
});

//html part ///
We are going to organize the Conference on IT on 2nd Feb 2010
Participants


Inline script or separate file doesn't seem to matter, so seems like
django is blocking this.

2) However more problems arise where Firefox/Chrome won't load ajax at
all !! Not even using django here. So I can't tell if there is a
django issue or FF.
This standard jquery example works for me only in Windows IE,
nothing else:

///js

$(function() {
$( "#tabs" ).tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html(
"Couldn't load this tab. We'll 
try to fix this as soon as
possible. " +
"If this wouldn't be a demo." );
}
}
});
});


html



Preloaded
Tab 1
Tab 2


blah



Any thoughts appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem using django and ajax-jQuery

2011-03-07 Thread Daniel Roseman
On Monday, March 7, 2011 3:32:51 PM UTC-8, Rami wrote:
>
> Thanks Andy!
>
> 1- you were correct about the form submitting the get method.
>
> 2- As you mentioned, the when I change the  if statement to 
> "request.GET.has_key('ajax')", it gets executed. the "?ajax" apparently 
> causes the statement to be interpreted as a GET (I didn't know that)
>
> The only reason I had the '/?ajax' in my syntax is because I was following 
> a tutorial that was for a get method. 
>

A clarification: the method is still POST. But it is possible to have both 
POST and GET data in the same request, which is what you've done here - data 
appended after the question-mark in a URL is GET, but the other data you're 
submitting is POST.
 

> Question:
>
> What is the difference between passing data variables to the server in the 
> URL vs in the [data] category of the the post method?
>
> i.e. having '/?ajax&id=' + $(this).attr('id') vs  id: $(this).attr('id')
>

As I say above, those appended to the URL are GET, and the others are POST. 
Practically speaking, for an AJAX request it makes very little difference, 
although good practice is still to use POST for actions that make changes 
(ie update the database).
--
DR. 

>  
>
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django + Ajax + Jquery

2010-06-06 Thread Massimiliano della Rovere
This is useful too: http://www.dajaxproject.com/

On Mon, Jun 7, 2010 at 07:57, Dmitry Dulepov  wrote:
> Hi!
>
> tazimk wrote:
>>     I want to use ajax in my templates using jquery.
>>     Can someone provide me some sample examples /links related to
>> this.
>
> http://www.google.com/ may be? The question is too broad.
>
> --
> Dmitry Dulepov
> Twitter: http://twitter.com/dmitryd/
> Web: http://dmitry-dulepov.com/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django + Ajax + Jquery

2010-06-06 Thread Dmitry Dulepov
Hi!

tazimk wrote:
> I want to use ajax in my templates using jquery.
> Can someone provide me some sample examples /links related to
> this.

http://www.google.com/ may be? The question is too broad.

-- 
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django + Ajax + Jquery

2010-06-06 Thread Andy Kelley
I'll go ahead and insert a plug here:

http://github.com/superjoe30/jst-parser

On Jun 6, 12:14 am, tazimk  wrote:
> Hi,
>
>     I want to use ajax in my templates using jquery.
>     Can someone provide me some sample examples /links related to
> this.
>     Also some sample examples on using Jquery efficiently

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django + Ajax + Jquery

2010-06-06 Thread Horst Gutmann
Django itself doesn't really care what JS framework you use and only
offers some framework agnostic helpers within the request object like
http://docs.djangoproject.com/en/1.2/ref/request-response/#django.http.HttpRequest.is_ajax
to distinguish requests coming as XHRs as well as
django.utils.simplejson for providing Python-version independent JSON
(de)serialization.

If you want more, there are some apps out there like dajax [1] out there :-)

[1] http://www.dajaxproject.com/

On Sun, Jun 6, 2010 at 9:14 AM, tazimk  wrote:
> Hi,
>
>    I want to use ajax in my templates using jquery.
>    Can someone provide me some sample examples /links related to
> this.
>    Also some sample examples on using Jquery efficiently
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django + Ajax + Jquery

2010-06-06 Thread tazimk
Hi,

I want to use ajax in my templates using jquery.
Can someone provide me some sample examples /links related to
this.
Also some sample examples on using Jquery efficiently

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django + Ajax + Jquery

2010-06-06 Thread tazimk
Hi,

I want to use ajax in my templates using jquery.
Can someone provide me some sample examples /links related to
this.
Also some sample examples on using Jquery efficiently

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Re: Ajax Jquery

2006-10-04 Thread James Bennett

On 9/29/06, patrickk <[EMAIL PROTECTED]> wrote:
> however, I´ve been a little bit disappointed at first that django
> doesn´t come with a js-library and that the django-developers refused
> to agree on a js-framework.

It isn't that there's a "refusal to agree", it's that there's a
recognition that the server-side app framework:

1. Shouldn't be trying to force a choice of client-side coding tools on you.
2. Shouldn't be trying to write client-side code (in the form of
"javascript helpers") for you.
3. Probably can't ever make a choice for JavaScript toolkit that will
satisfy enough end users. If we go with Dojo, Prototype fans will be
angry. If we go with Prototype, YUI fans will be angry. If we go with
YUI, JQuery fans will be angry.

This is a case where the only way to "win" is not to play the game at
all, which means not bundling or "integrating" a JS toolkit.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Re: Ajax Jquery

2006-10-04 Thread Brandon Aaron

On 9/29/06, patrickk <[EMAIL PROTECTED]> wrote:
> well, this is not really a question.
> however, I´ve been a little bit disappointed at first that django
> doesn´t come with a js-library and that the django-developers refused
> to agree on a js-framework.
> in the meantime, I totally understand that decision and I´m very
> happy with it. we are currently using jquery and we´ve been using
> dojo before. so, we switched the js-library - and it was very easy
> because it has nothing to do with django.
>
> patrick.

I think it is best to keep the JavaScript library out of the core. I
would rather not be stuck using dojo, prototype or even stuck using
jQuery. However, if a choice has to be made, my vote is for jQuery. :)

--
Brandon Aaron

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax Jquery

2006-09-29 Thread limodou

On 9/30/06, patrickk <[EMAIL PROTECTED]> wrote:
>
>
> Am 29.09.2006 um 18:35 schrieb Onno Timmerman:
>
> >
> > Hello,
> >
> > I started to learn Django this week and have a lot of questions. My
> > background is PHP.
> > I hope to save time with Django and be able to do more.
> >
> > My first question:
> > Many frameworks are working with a ajax framework. I realy like
> > Jquery.com... It's easy and very intiutive, the same philosophy as
> > Django has.
>
> well, this is not really a question.
> however, I´ve been a little bit disappointed at first that django
> doesn´t come with a js-library and that the django-developers refused
> to agree on a js-framework.
> in the meantime, I totally understand that decision and I´m very
> happy with it. we are currently using jquery and we´ve been using
> dojo before. so, we switched the js-library - and it was very easy
> because it has nothing to do with django.
>
> patrick.
>
I'm also studying jQuery now, and I think it's an interesting ajax
framework, and I'm trying to use jquery to auto create management
interface according Django Model, and simplify the view process.

I'v finished a table, and form integration, so you can add, delete,
edit records without leaving current page. All these is handled
through ajax. For client side, you just need to fill in the admin
template, for example: fields, forms, others things will be created by
js. And for server, you only need to think about first render, data
load, add, delete, edit. And template is only used in first render
stage. Others will only return json format data.

-- 
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax Jquery

2006-09-29 Thread Kenneth Gonsalves


On 29-Sep-06, at 10:05 PM, Onno Timmerman wrote:

> Are there books about Django, and what books do you recomend to get me
> up to speed with Python!

python in a nutshell - o'reilly

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax Jquery

2006-09-29 Thread Russell Keith-Magee

On 9/30/06, Onno Timmerman <[EMAIL PROTECTED]> wrote:
>
> Second questions:
> Are there books about Django, and what books do you recomend to get me
> up to speed with Python!

www.diveintopython.org is one of the best Python primers I know of.
It's also available in   dead tree version.

As for Django - there is a book under development. If you search
Amazon, you will find it - but ignore the publication date. Amazon is
quoting October, but that isn't accurate.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax Jquery

2006-09-29 Thread patrickk


Am 29.09.2006 um 18:35 schrieb Onno Timmerman:

>
> Hello,
>
> I started to learn Django this week and have a lot of questions. My
> background is PHP.
> I hope to save time with Django and be able to do more.
>
> My first question:
> Many frameworks are working with a ajax framework. I realy like
> Jquery.com... It's easy and very intiutive, the same philosophy as
> Django has.

well, this is not really a question.
however, I´ve been a little bit disappointed at first that django  
doesn´t come with a js-library and that the django-developers refused  
to agree on a js-framework.
in the meantime, I totally understand that decision and I´m very  
happy with it. we are currently using jquery and we´ve been using  
dojo before. so, we switched the js-library - and it was very easy  
because it has nothing to do with django.

patrick.

>
> Second questions:
> Are there books about Django, and what books do you recomend to get me
> up to speed with Python!
>
> Onno
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Ajax Jquery

2006-09-29 Thread charles sibbald
book on python www.thinkpython.comOnno Timmerman <[EMAIL PROTECTED]> wrote: Hello,I started to learn Django this week and have a lot of questions. My background is PHP.I hope to save time with Django and be able to do more.My first question:Many frameworks are working with a ajax framework. I realy like Jquery.com... It's easy and very intiutive, the same philosophy as Django has.Second questions:Are there books about Django, and what books do you recomend to get me up to speed with Python!Onno		 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---


Ajax Jquery

2006-09-29 Thread Onno Timmerman

Hello,

I started to learn Django this week and have a lot of questions. My 
background is PHP.
I hope to save time with Django and be able to do more.

My first question:
Many frameworks are working with a ajax framework. I realy like 
Jquery.com... It's easy and very intiutive, the same philosophy as 
Django has.

Second questions:
Are there books about Django, and what books do you recomend to get me 
up to speed with Python!

Onno

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---