Re: Django Captcha Ajax call not working

2017-03-28 Thread valerio orfano
Hi Melvyin still not working $(".captcha_form").submit(function(event){ event.preventDefault(); var form = $(this) alert (form.serialize()) $.ajax({ type: "POST", url: "./captcha", contentTy

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
Hi Melvyn thanx a lot . I will try tomorrow early morning and will let u know. Thanx. valerio On Monday, March 27, 2017 at 3:31:38 PM UTC+2, Melvyn Sopacua wrote: > > Hi, > > > > {% if field.name = 'captcha' %} > > > > assigns 'captcha' to field.name and returns if that succeeded. So it's

Re: Django Captcha Ajax call not working

2017-03-27 Thread Melvyn Sopacua
Hi, {% if field.name = 'captcha' %} assigns 'captcha' to field.name and returns if that succeeded. So it's always true. You probably mean: {% if field.name == 'captcha' %} >From what you describe, testfield shows up and your template code says it >shouldn't show up. However, when debugging

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
testfield is where i type my captcha, sorry On Monday, March 27, 2017 at 2:38:15 PM UTC+2, valerio orfano wrote: > > Hi Melvyn thanx for ur reply, > > this is my form. > > class AjaxForm(forms.ModelForm): > captcha = CaptchaField() > class Meta: > model = ajaxModel > exclud

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
Hi Melvyn thanx for ur reply, this is my form. class AjaxForm(forms.ModelForm): captcha = CaptchaField() class Meta: model = ajaxModel exclude = [] class ajaxModel(models.Model): testfield = models.TextField(null=True, blank=True) If i don't use a ajaxmodel a get an

Re: Django Captcha Ajax call not working

2017-03-27 Thread Melvyn Sopacua
On Monday 27 March 2017 04:46:06 valerio orfano wrote: > {% if field.name = 'captcha' %} It may not make a difference if you only have one visible field, but this is not a comparison. -- Melvyn Sopacua -- You received this message because you are subscribed to the Google Groups "Django users

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
btw this is my html: {%csrf_token%} {{ form.non_field_errors }} {% for field in form.visible_fields %} {% if field.name = 'captcha' %} {{field}} {% endif %} {{ field.errors }} {% endfor %} {% for field in form.hidden_fields %} {{ field }}

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
Hi Andreas thak you very much. I've changed my html with the following: $(document).ready(function(){ $.ajaxSetup({ beforeSend: function(xhr, settings) { function getCookie(name) { var cookieValue = null; if

Re: Django Captcha Ajax call not working

2017-03-27 Thread ludovic coues
You Ajax call have a suspicious "data: {}" in the middle of all the arguments. On 27 Mar 2017 10:23 am, "valerio orfano" wrote: Hi, I managed to make an ajax call. But the form is always invalid. IT is like the captcha field passed to the view is always empty. valerio On Monday, March 27, 201

Re: Django Captcha Ajax call not working

2017-03-27 Thread Andréas Kühne
Hi, First of all - you are not sending anything to the form. $.ajax({ type: "POST", url: "../captcha", contentType: "application/json", data: {}, dataType: "json", success: function(data) {

Re: Django Captcha Ajax call not working

2017-03-27 Thread valerio orfano
Hi, I managed to make an ajax call. But the form is always invalid. IT is like the captcha field passed to the view is always empty. valerio On Monday, March 27, 2017 at 8:48:17 AM UTC+2, valerio orfano wrote: > > I have the following class view taken from documentation: > > class CaptchaView(Cr

Django Captcha Ajax call not working

2017-03-26 Thread valerio orfano
I have the following class view taken from documentation: class CaptchaView(CreateView): template_name = "captcha.html" form_class = MyForm def form_invalid(self, form): if self.request.is_ajax(): to_json_response = dict() to_json_response['status']