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",
contentType: "application/json",
data: form.serialize(), 
dataType: "json",
success: function(data) {
alert(data.status);
  },
error: function(data) {
alert("NOT_OK");
  }  
});
});
});


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





If i make the call using form post method it validates, if use ajax post 
method with form.serialize() it not validates? The problem for sure ios 
with ajax call!

Please help out!

rgds valerio



On Monday, March 27, 2017 at 5:44:34 PM UTC+2, valerio orfano wrote:
>
> 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 
>> 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 a problem, always reduce to the simplest case, so 
>> try with this template code:
>>
>>  
>>
>> > method="post">{%csrf_token%}
>>
>> {{ form }}
>>
>> > value="Invio"/>
>>
>> 
>>
>>  
>>
>> On Monday 27 March 2017 05:43:53 valerio orfano wrote:
>>
>> > 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
>>
>> > > exclude = []
>>
>> > > 
>>
>> > > class ajaxModel(models.Model):
>>
>> > > testfield = models.TextField(null=True, blank=True)
>>
>> > > 
>>
>> > > If i don't use a ajaxmodel a get an error, so testfield is just a
>>
>> > > dummy field, just to avoid error.
>>
>> > > 
>>
>> > > valerio
>>
>> > > 
>>
>> > > On Monday, March 27, 2017 at 2:22:44 PM UTC+2, Melvyn Sopacua wrote:
>>
>> > >> 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
>>
>>  
>>
>> -- 
>>
>> Melvyn Sopacua
>>
>

-- 
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/10f4a9e3-4297-44c2-9840-2b09773cfbee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 
> 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 a problem, always reduce to the simplest case, so 
> try with this template code:
>
>  
>
>  method="post">{%csrf_token%}
>
> {{ form }}
>
>  value="Invio"/>
>
> 
>
>  
>
> On Monday 27 March 2017 05:43:53 valerio orfano wrote:
>
> > 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
>
> > > exclude = []
>
> > > 
>
> > > class ajaxModel(models.Model):
>
> > > testfield = models.TextField(null=True, blank=True)
>
> > > 
>
> > > If i don't use a ajaxmodel a get an error, so testfield is just a
>
> > > dummy field, just to avoid error.
>
> > > 
>
> > > valerio
>
> > > 
>
> > > On Monday, March 27, 2017 at 2:22:44 PM UTC+2, Melvyn Sopacua wrote:
>
> > >> 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
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/ea58c8fa-6e88-4c0f-b0a7-01ddd223885a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 a problem, always reduce to the simplest case, so try 
with 
this template code:

{%csrf_token%}
   {{ form }}



On Monday 27 March 2017 05:43:53 valerio orfano wrote:
> 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
> > exclude = []
> > 
> > class ajaxModel(models.Model):
> > testfield = models.TextField(null=True, blank=True)
> > 
> > If i don't use a ajaxmodel a get an error, so testfield is just a
> > dummy field, just to avoid error.
> > 
> > valerio
> > 
> > On Monday, March 27, 2017 at 2:22:44 PM UTC+2, Melvyn Sopacua wrote:
> >> 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

-- 
Melvyn Sopacua

-- 
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/3622592.22LVN5Jdkp%40devstation.
For more options, visit https://groups.google.com/d/optout.


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
> exclude = []
>
> class ajaxModel(models.Model):
> testfield = models.TextField(null=True, blank=True)
>
> If i don't use a ajaxmodel a get an error, so testfield is just a dummy 
> field, just to avoid error.
>
> valerio
>
> On Monday, March 27, 2017 at 2:22:44 PM UTC+2, Melvyn Sopacua wrote:
>>
>> 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" 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/3a51903e-742c-4156-ad3d-7db6ce90ba12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 error, so testfield is just a dummy 
field, just to avoid error.

valerio

On Monday, March 27, 2017 at 2:22:44 PM UTC+2, Melvyn Sopacua wrote:
>
> 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" 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/5d0cb24a-7790-4bca-80b7-7a04bfaa0165%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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" 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/2151511.RICxuiXsZK%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 }}
{% endfor %}




On Monday, March 27, 2017 at 1:44:49 PM UTC+2, valerio orfano wrote:
>
> 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 (document.cookie && document.cookie != '') {
>  var cookies = document.cookie.split(';');
>  for (var i = 0; i < cookies.length; i++) {
>  var cookie = jQuery.trim(cookies[i]);
>  // Does this cookie string begin with the 
> name we want?
>  if (cookie.substring(0, name.length + 1) == 
> (name + '=')) {
>  cookieValue = 
> decodeURIComponent(cookie.substring(name.length + 1));
>  break;
>  }
>  }
>  }
>  return cookieValue;
>  }
>  if (!(/^http:.*/.test(settings.url) || 
> /^https:.*/.test(settings.url))) {
>  // Only send the token to relative URLs i.e. locally.
>  xhr.setRequestHeader("X-CSRFToken", 
> getCookie('csrftoken'));
>  }
>  } 
> });
> 
> $(".captcha_form").submit(function(event){
> alert("passa");
> event.preventDefault();
> $.ajax({
> type: "POST",  
> url: "./captcha",
> contentType: "application/json",
> data: $(this).serialize(),
> dataType: "json",
> success: function(data) {
> alert(data.status);
>   },
> error: function(data) {
> alert("NOT_OK");
>   }  
> });
> });
> });
> 
>
> But my alert returns always status=0 that means invalid form. Any help ?
>
> Thx a lot
>
>
> On Monday, March 27, 2017 at 11:05:23 AM UTC+2, Andréas Kühne wrote:
>>
>> 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) {
>> alert("success");
>>   },
>> error: function(data) {
>> alert("not OK");
>>   }
>>
>> });
>>
>> This says that the data sent to the method SHOULD be empty - so the form 
>> will always be invalid - there is nothing in it. You probably want to 
>> include your form in the data part of the jquery request. Check this for 
>> more information: https://api.jquery.com/serialize/.
>>
>> Secondly - you should also include the CSRF token - otherwise you will 
>> get other errors with that eventually - check this for information on how 
>> to do that: https://docs.djangoproject.com/en/1.10/ref/csrf/#ajax
>>
>> Regards,
>>
>> Andréas
>>
>> 2017-03-27 10:22 GMT+02:00 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(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'] = 0
 to_json_response['form_errors'] = form.errors

 to_json_response['new_cptch_key'] = 
 CaptchaStore.generate_key()
 to_json_response['new_cptch_image'] = 
 captcha_image_url(to_json_response['new_cptch_key'])

 return HttpResponse(json.dumps(to_json_response), 
 content_type='application/json')
 else:
 return HttpResponse("test1", 
 content_type='application/json')

 def form_valid(self, form):
 if self.request.is_ajax():
 to_json_response = dict()
 to_json_response['status'] = 1

 to_json_response['new_cptch_key'] = 
>>

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 (document.cookie && document.cookie != '') {
 var cookies = document.cookie.split(';');
 for (var i = 0; i < cookies.length; i++) {
 var cookie = jQuery.trim(cookies[i]);
 // Does this cookie string begin with the name 
we want?
 if (cookie.substring(0, name.length + 1) == 
(name + '=')) {
 cookieValue = 
decodeURIComponent(cookie.substring(name.length + 1));
 break;
 }
 }
 }
 return cookieValue;
 }
 if (!(/^http:.*/.test(settings.url) || 
/^https:.*/.test(settings.url))) {
 // Only send the token to relative URLs i.e. locally.
 xhr.setRequestHeader("X-CSRFToken", 
getCookie('csrftoken'));
 }
 } 
});

$(".captcha_form").submit(function(event){
alert("passa");
event.preventDefault();
$.ajax({
type: "POST",  
url: "./captcha",
contentType: "application/json",
data: $(this).serialize(),
dataType: "json",
success: function(data) {
alert(data.status);
  },
error: function(data) {
alert("NOT_OK");
  }  
});
});
});


But my alert returns always status=0 that means invalid form. Any help ?

Thx a lot


On Monday, March 27, 2017 at 11:05:23 AM UTC+2, Andréas Kühne wrote:
>
> 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) {
> alert("success");
>   },
> error: function(data) {
> alert("not OK");
>   }
>
> });
>
> This says that the data sent to the method SHOULD be empty - so the form 
> will always be invalid - there is nothing in it. You probably want to 
> include your form in the data part of the jquery request. Check this for 
> more information: https://api.jquery.com/serialize/.
>
> Secondly - you should also include the CSRF token - otherwise you will get 
> other errors with that eventually - check this for information on how to do 
> that: https://docs.djangoproject.com/en/1.10/ref/csrf/#ajax
>
> Regards,
>
> Andréas
>
> 2017-03-27 10:22 GMT+02:00 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(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'] = 0
>>> to_json_response['form_errors'] = form.errors
>>>
>>> to_json_response['new_cptch_key'] = 
>>> CaptchaStore.generate_key()
>>> to_json_response['new_cptch_image'] = 
>>> captcha_image_url(to_json_response['new_cptch_key'])
>>>
>>> return HttpResponse(json.dumps(to_json_response), 
>>> content_type='application/json')
>>> else:
>>> return HttpResponse("test1", content_type='application/json')
>>>
>>> def form_valid(self, form):
>>> if self.request.is_ajax():
>>> to_json_response = dict()
>>> to_json_response['status'] = 1
>>>
>>> to_json_response['new_cptch_key'] = 
>>> CaptchaStore.generate_key()
>>> to_json_response['new_cptch_image'] = 
>>> captcha_image_url(to_json_response['new_cptch_key'])
>>>
>>> return HttpResponse(json.dumps(to_json_response), 
>>> content_type='application/json')
>>> else:
>>> return HttpResponse("test2", content_type='application/json')
>>>
>>>
>>> and the following ajax call from template:
>>>
>>> 
>>> function captcha() {
>>> $.ajax({
>>> type: "POST",  
>>> url: "../captcha",
>>> contentType: "a

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, 2017 at 8:48:17 AM UTC+2, valerio orfano wrote:
>
> 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'] = 0
> to_json_response['form_errors'] = form.errors
>
> to_json_response['new_cptch_key'] =
> CaptchaStore.generate_key()
> to_json_response['new_cptch_image'] =
> captcha_image_url(to_json_response['new_cptch_key'])
>
> return HttpResponse(json.dumps(to_json_response),
> content_type='application/json')
> else:
> return HttpResponse("test1", content_type='application/json')
>
> def form_valid(self, form):
> if self.request.is_ajax():
> to_json_response = dict()
> to_json_response['status'] = 1
>
> to_json_response['new_cptch_key'] =
> CaptchaStore.generate_key()
> to_json_response['new_cptch_image'] =
> captcha_image_url(to_json_response['new_cptch_key'])
>
> return HttpResponse(json.dumps(to_json_response),
> content_type='application/json')
> else:
> return HttpResponse("test2", content_type='application/json')
>
>
> and the following ajax call from template:
>
> 
> function captcha() {
> $.ajax({
> type: "POST",
> url: "../captcha",
> contentType: "application/json",
> data: {},
> dataType: "json",
> success: function(data) {
> alert("success");
>   },
> error: function(data) {
> alert("not OK");
>   }
>
> });
> }
> 
>
>
> 
>
> url(r'^captcha$', views.CaptchaView.as_view(), name="captcha")
>
> Could you please help me to get a proper ajax call? When i click the OK
> button no success or error message is displayed!!!
>
> Please help me out!!
>
> thanx
>
> valerio
>
>
> --
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/32c46521-92be-40be-820a-fb5fe63c4620%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaQk69ZVZHwjEv_wrd3_zFO00s8W_%3DpEPYLcUuGj3QBYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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) {
alert("success");
  },
error: function(data) {
alert("not OK");
  }

});

This says that the data sent to the method SHOULD be empty - so the form
will always be invalid - there is nothing in it. You probably want to
include your form in the data part of the jquery request. Check this for
more information: https://api.jquery.com/serialize/.

Secondly - you should also include the CSRF token - otherwise you will get
other errors with that eventually - check this for information on how to do
that: https://docs.djangoproject.com/en/1.10/ref/csrf/#ajax

Regards,

Andréas

2017-03-27 10:22 GMT+02:00 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(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'] = 0
>> to_json_response['form_errors'] = form.errors
>>
>> to_json_response['new_cptch_key'] =
>> CaptchaStore.generate_key()
>> to_json_response['new_cptch_image'] =
>> captcha_image_url(to_json_response['new_cptch_key'])
>>
>> return HttpResponse(json.dumps(to_json_response),
>> content_type='application/json')
>> else:
>> return HttpResponse("test1", content_type='application/json')
>>
>> def form_valid(self, form):
>> if self.request.is_ajax():
>> to_json_response = dict()
>> to_json_response['status'] = 1
>>
>> to_json_response['new_cptch_key'] =
>> CaptchaStore.generate_key()
>> to_json_response['new_cptch_image'] =
>> captcha_image_url(to_json_response['new_cptch_key'])
>>
>> return HttpResponse(json.dumps(to_json_response),
>> content_type='application/json')
>> else:
>> return HttpResponse("test2", content_type='application/json')
>>
>>
>> and the following ajax call from template:
>>
>> 
>> function captcha() {
>> $.ajax({
>> type: "POST",
>> url: "../captcha",
>> contentType: "application/json",
>> data: {},
>> dataType: "json",
>> success: function(data) {
>> alert("success");
>>   },
>> error: function(data) {
>> alert("not OK");
>>   }
>>
>> });
>> }
>> 
>>
>>
>> 
>>
>> url(r'^captcha$', views.CaptchaView.as_view(), name="captcha")
>>
>> Could you please help me to get a proper ajax call? When i click the OK
>> button no success or error message is displayed!!!
>>
>> Please help me out!!
>>
>> thanx
>>
>> valerio
>>
>>
>> --
> 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/32c46521-92be-40be-820a-fb5fe63c4620%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCdhmMa7Zxnh-e3Q7ccA-h9b%2Bn0XSOVrGttVVVQWQ79oAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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(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'] = 0
> to_json_response['form_errors'] = form.errors
>
> to_json_response['new_cptch_key'] = CaptchaStore.generate_key()
> to_json_response['new_cptch_image'] = 
> captcha_image_url(to_json_response['new_cptch_key'])
>
> return HttpResponse(json.dumps(to_json_response), 
> content_type='application/json')
> else:
> return HttpResponse("test1", content_type='application/json')
>
> def form_valid(self, form):
> if self.request.is_ajax():
> to_json_response = dict()
> to_json_response['status'] = 1
>
> to_json_response['new_cptch_key'] = CaptchaStore.generate_key()
> to_json_response['new_cptch_image'] = 
> captcha_image_url(to_json_response['new_cptch_key'])
>
> return HttpResponse(json.dumps(to_json_response), 
> content_type='application/json')
> else:
> return HttpResponse("test2", content_type='application/json')
>
>
> and the following ajax call from template:
>
> 
> function captcha() {
> $.ajax({
> type: "POST",  
> url: "../captcha",
> contentType: "application/json",
> data: {},
> dataType: "json",
> success: function(data) {
> alert("success");
>   },
> error: function(data) {
> alert("not OK");
>   }
>
> });
> }
> 
>
>
> 
>
> url(r'^captcha$', views.CaptchaView.as_view(), name="captcha")
>
> Could you please help me to get a proper ajax call? When i click the OK 
> button no success or error message is displayed!!!
>
> Please help me out!!
>
> thanx
>
> valerio
>
>
>

-- 
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/32c46521-92be-40be-820a-fb5fe63c4620%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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'] = 0
to_json_response['form_errors'] = form.errors

to_json_response['new_cptch_key'] = CaptchaStore.generate_key()
to_json_response['new_cptch_image'] = 
captcha_image_url(to_json_response['new_cptch_key'])

return HttpResponse(json.dumps(to_json_response), 
content_type='application/json')
else:
return HttpResponse("test1", content_type='application/json')

def form_valid(self, form):
if self.request.is_ajax():
to_json_response = dict()
to_json_response['status'] = 1

to_json_response['new_cptch_key'] = CaptchaStore.generate_key()
to_json_response['new_cptch_image'] = 
captcha_image_url(to_json_response['new_cptch_key'])

return HttpResponse(json.dumps(to_json_response), 
content_type='application/json')
else:
return HttpResponse("test2", content_type='application/json')


and the following ajax call from template:


function captcha() {
$.ajax({
type: "POST",  
url: "../captcha",
contentType: "application/json",
data: {},
dataType: "json",
success: function(data) {
alert("success");
  },
error: function(data) {
alert("not OK");
  }

});
}





url(r'^captcha$', views.CaptchaView.as_view(), name="captcha")

Could you please help me to get a proper ajax call? When i click the OK 
button no success or error message is displayed!!!

Please help me out!!

thanx

valerio


-- 
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/2877f6c0-928a-47e1-8398-f57ef3200aba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Captcha or MathCaptcha application

2017-03-23 Thread Camilo Torres
May be you are missing a data base migration?

-- 
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/d764a469-2dd8-44c7-8cae-32b586c20147%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Captcha or MathCaptcha application

2017-03-23 Thread valerio orfano

Belowe the steps i have followed, but it doesnt work. I type in my browser 
: www.localhost/capthca but no image is displayeded and i get an error : no 
such table: captcha_captchastore

I dont find it very simple as suggested from documentation. Do you have any 
simple tutorial?

1.pip install captcha, pillow

2.edit setting.py in installed app to mention 'captcha'

3.after that add URL to urls.py,url(r'^captcha/', 
include('captcha.urls'))
should captcha.urls contain any row

4.  forms.py:

from captcha.fields import CaptchaField

class CaptchaTestForm(forms.Form):
captcha = CaptchaField()


5.  Submit and change the captcha .html file
{% load tags %}
{% load static %}
{% autoescape off %}



{%csrf_token%}
{{form}}
 



{% endautoescape %}

views.py

def captcha(request):
if request.POST:
form = CaptchaTestForm(request.POST)
# Validate the form: the captcha field will automatically
# check the input
if form.is_valid():
human = True
HttpResponse("passa")
else:
form = CaptchaTestForm()
else:
form = CaptchaTestForm()
return render_to_response('captcha.html', {'form':form}, 
context_instance=RequestContext(request))


On Wednesday, March 22, 2017 at 3:41:10 PM UTC+1, Thiago Parolin wrote:
>
> I am using django-recaptcha2, that is a google recaptcha...
> Very simple to setup and use and works very well
>
> 2017-03-22 11:20 GMT-03:00 valerio orfano  >:
>
>> Hi 
>>
>> i am trying to apply captcha process to my web site. I could find any 
>> clear documentation out there (at least clear to me). Do you know any 
>> simple step by step tutorial or captcha application source code you have 
>> already created and that works fine?
>>
>> I am looking for code regarding view, urls, template, form and class 
>> snippet.
>>
>> Thanx for your support 
>>
>> valerio
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/28e5169e-6800-4b85-ba3f-63f3621e85c9%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1cf4ab3-d41a-4cbe-a5fb-cff0a08fa5ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Captcha or MathCaptcha application

2017-03-22 Thread Thiago Parolin
I am using django-recaptcha2, that is a google recaptcha...
Very simple to setup and use and works very well

2017-03-22 11:20 GMT-03:00 valerio orfano :

> Hi
>
> i am trying to apply captcha process to my web site. I could find any
> clear documentation out there (at least clear to me). Do you know any
> simple step by step tutorial or captcha application source code you have
> already created and that works fine?
>
> I am looking for code regarding view, urls, template, form and class
> snippet.
>
> Thanx for your support
>
> valerio
>
> --
> 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/28e5169e-6800-4b85-ba3f-63f3621e85c9%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACTnJ013zFzwu69qzU%2BnXfaQmR0G7i4o9tf0ZNVMURL71v3yXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Captcha or MathCaptcha application

2017-03-22 Thread valerio orfano
Hi 

i am trying to apply captcha process to my web site. I could find any clear 
documentation out there (at least clear to me). Do you know any simple step 
by step tutorial or captcha application source code you have already 
created and that works fine?

I am looking for code regarding view, urls, template, form and class 
snippet.

Thanx for your support 

valerio

-- 
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/28e5169e-6800-4b85-ba3f-63f3621e85c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django captcha

2009-05-21 Thread Dougal Matthews
because its easy for them and they don't really get anything from doing it
otherwise? ;)

You'll find you have to head to SVN quite often to get projects in Django
I'm afraid, it just seems to be fairly common practice. Although, many
people are moving to github and it offers a download.

Cheers,
Dougal


---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/



2009/5/21 online 

>
> So i have to install svn on mymachine? Why people make download so
> complicated...
>
>
>
>
>
>
> On May 20, 10:22 pm, jai  wrote:
> > svn checkouthttp://django-simple-captcha.googlecode.com/svn/trunk/
> > django-simple-captcha-read-only
> >
> > On May 21, 9:30 am, online  wrote:
> >
> > > Could anyone please recommend a open source library captcha working
> > > fine with django?
> >
> > >http://code.google.com/p/django-simple-captcha/ looks but i just
> > > cannot find where to download.
> >
> > > Thanks
> >
>

--~--~-~--~~~---~--~~
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 captcha

2009-05-21 Thread online

So i have to install svn on mymachine? Why people make download so
complicated...






On May 20, 10:22 pm, jai  wrote:
> svn checkouthttp://django-simple-captcha.googlecode.com/svn/trunk/
> django-simple-captcha-read-only
>
> On May 21, 9:30 am, online  wrote:
>
> > Could anyone please recommend a open source library captcha working
> > fine with django?
>
> >http://code.google.com/p/django-simple-captcha/ looks but i just
> > cannot find where to download.
>
> > Thanks
--~--~-~--~~~---~--~~
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 captcha

2009-05-20 Thread jai

svn checkout http://django-simple-captcha.googlecode.com/svn/trunk/
django-simple-captcha-read-only

On May 21, 9:30 am, online  wrote:
> Could anyone please recommend a open source library captcha working
> fine with django?
>
> http://code.google.com/p/django-simple-captcha/ looks but i just
> cannot find where to download.
>
> Thanks
--~--~-~--~~~---~--~~
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 captcha

2009-05-20 Thread Sam Kuper
2009/5/21 online 

> Could anyone please recommend a open source library captcha working
> fine with django?


Personally, I'm a fan of ReCAPTCHA, but it may not be quite what you're
after.


> http://code.google.com/p/django-simple-captcha/  looks but i just
> cannot find where to download.


You can download this by checking out the head of the project's subversion
repository.

Sam

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django captcha

2009-05-20 Thread online

Could anyone please recommend a open source library captcha working
fine with django?

http://code.google.com/p/django-simple-captcha/  looks but i just
cannot find where to download.

Thanks


--~--~-~--~~~---~--~~
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 captcha apps

2009-04-07 Thread Martin
Did you browse google code already?

http://code.google.com/p/django-captcha/

I bet there are more apps there...

Best regards,
Martin

2009/4/8 Joshua Partogi 

>
> Hi all,
>
> Can anyone recommend me any good django captcha apps? I tried search
> on the list but the results that is returned is mostly about errors
> with django captcha.
>
> Thank you very much in advance.
>
> --
> If you can't believe in God the chances are your God is too small.
>
> Read my blog: http://joshuajava.wordpress.com/
> Follow us on twitter: http://twitter.com/scrum8
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django captcha apps

2009-04-07 Thread Joshua Partogi

Hi all,

Can anyone recommend me any good django captcha apps? I tried search
on the list but the results that is returned is mostly about errors
with django captcha.

Thank you very much in advance.

-- 
If you can't believe in God the chances are your God is too small.

Read my blog: http://joshuajava.wordpress.com/
Follow us on twitter: http://twitter.com/scrum8

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with django captcha module

2007-10-25 Thread BitBlazer

Hi,

I just tried the django captcha module in my application. Everything
is fine except for one small problem. The code that extracts the font
files from `fonts` directory doesn't pay attention to the hidden
files. For example all my code is in SVN. As a result each project
folder has a hidden .svn folder. The code for extracting the files
from fonts directory directly uses the listdir() function without
bothering about hidden files (.svn in my case). As a result the
listing of font files also includes an erroneous font entry with the
name `path/to/fonts/dir/.svn` which raises IOError when used (which
happens randomly). Even though I have fixed this problem in my case
but I guess there should be a proper solution for same.

Cheers!
BitBlazer


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Django Captcha (solution, with code)

2007-04-25 Thread [EMAIL PROTECTED]

I'm pretty new to django, but I did recently convert my personal site
to be primarily django based.  This is primarily a blog application,
with a few little site-specific extras.

I soon realized that I'd need some kind of comment spam prevention,
but found the existing Django captcha solutions on the web cumbersome
and difficult to integrate.

As a result, I've made my own.  Please check it out from
http://test.lostlogicx.com/transfer/captcha.tar.bz2  Also you can see
it in action at http://django-test.lostlogicx.com/ (Adding a comment
to any item or a reply to any comment).

The best thing that I can say about my Captcha system for Django
compared to others is that mine required changing exactly 3 lines of
code in my main application in order to use it.  1) settings 2) urls
3) the form parameter to form_for_model on the form that I wanted to
Captcha.

The only dependency beyond Django that I know of is PIL for image
generation.

Like I said, I'm pretty new to Django (and Python), so I'm sure that a
lot of what I did is hacky and or ugly.  Please please tell me what
I've done that's stupid so that I can work on fixing it.

Thanks for reading and your feedback,

Brandon Low


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Django Captcha

2006-05-20 Thread Ian Holsman

just as a followup to this.
Scott was using the 'old pre-MR merge' version of this code, when he  
updated to the up2date version it worked for him

regards
Ian

On 19/05/2006, at 10:15 PM, Scott Anderson wrote:

>
> Thanks for the reply, Ian.
>
> I have those libraries installed. I'm sure it's just some  
> configuration
> I've done improperly.
>
> I've sent you a gmail contact (scottanderson42); since you're in
> Australia I'm sure I'll have to wait for the daylight terminator to  
> come
> back round your way again. :-)
>
> Regards,
> -scott
>
> On Fri, 2006-05-19 at 16:42 +1000, Ian Holsman wrote:
>> Hi.
>>
>> I wrote that app, and it does work (for me at least)
>>
>> some of the main problems I have had in the past with it is the lack
>> of dependant libraries.
>> you need
>>
>> pycaptcha
>> and
>> Imaging
>> and
>> pycrypto (if you want to use the register app in that SVN)
>>
>> If you want, feel free to ping me on irc (my nick is firemansam) or
>> Skype: iholsman / gtalk: kryton _at_ gmail.com
>> and we'll get it sorted out for you. (and post back the answer here
>> for next time)
>>
>> On 19/05/2006, at 12:47 PM, Scott Anderson wrote:
>>
>>>
>>> Hi all,
>>>
>>> I'm a new Django user trying to get the captcha app working with svn
>>> Django.
>>>
>>> I've done the following:
>>>
>>> 1) Placed the captcha app in my site directory (which is named
>>> 'craft')
>>> 2) Added a reference to "craft.captcha" to INSTALLED_APPS in
>>> settings.py
>>> 3) Placed {% load captcha %} and {% captcha %} in my template (in
>>> user/templates/register.html)
>>> 4) Included the craft.captcha.urls reference in the site's  
>>> urls.py for
>>> ^captcha/
>>>
>>>
>>> When I visit the register template, however, I get the following
>>> error:
>>>
>>> 'captcha' is not a valid tag library: Could not load template  
>>> library
>>> from django.templatetags.captcha, cannot import name template
>>>
>>>> From the "load captcha" line in the template.
>>>
>>> I'm sure I'm missing something simple, but I'm not familiar enough
>>> with
>>> Django yet to figure out what it is. I've also tried "load
>>> craft.captcha", but no dice.
>>>
>>> Thanks for any help in advance,
>>> -scott
>>>
>>>
>>>
>>>>
>>
>>
>>>
>
>
> >

X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.54.131.10 with SMTP id e10mr156047wrd;
Sat, 20 May 2006 15:58:10 -0700 (PDT)
Return-Path: <[EMAIL PROTECTED]>
Received: from circe.holsman.net (218-214-209-234.people.net.au 
[218.214.209.234])
by mx.googlegroups.com with ESMTP id v11si494302cwb.2006.05.20.15.58.09;
Sat, 20 May 2006 15:58:10 -0700 (PDT)
Received-SPF: neutral (googlegroups.com: 218.214.209.234 is neither permitted 
nor denied by domain of [EMAIL PROTECTED])
Received: from [127.0.0.1] (localhost [127.0.0.1])
by circe.holsman.net (Postfix) with ESMTP id 19BF91C5ED3
for ; Sun, 21 May 2006 08:57:57 +1000 
(EST)
Mime-Version: 1.0
Content-Type: text/plain
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Message-Id: <[EMAIL PROTECTED]>
From: Ian Holsman <[EMAIL PROTECTED]>
Subject: Re: Problem with Django Captcha
Date: Sun, 21 May 2006 08:57:56 +1000
To: django-users@googlegroups.com
X-Mailer: Apple Mail (2.750)

just as a followup to this.
Scott was using the 'old pre-MR merge' version of this code, when he  
updated to the up2date version it worked for him

regards
Ian

On 19/05/2006, at 10:15 PM, Scott Anderson wrote:

>
> Thanks for the reply, Ian.
>
> I have those libraries installed. I'm sure it's just some  
> configuration
> I've done improperly.
>
> I've sent you a gmail contact (scottanderson42); since you're in
> Australia I'm sure I'll have to wait for the daylight terminator to  
> come
> back round your way again. :-)
>
> Regards,
> -scott
>
> On Fri, 2006-05-19 at 16:42 +1000, Ian Holsman wrote:
>> Hi.
>>
>> I wrote that app, and it does work (for me at least)
>>
>> some of the main problems I have had in the past with it is the lack
>> of dependant libraries.
>> you need
>>
>> pycaptcha
>> and
>> Imaging
>> 

Re: Problem with Django Captcha

2006-05-19 Thread Scott Anderson

Thanks for the reply, Ian.

I have those libraries installed. I'm sure it's just some configuration
I've done improperly.

I've sent you a gmail contact (scottanderson42); since you're in
Australia I'm sure I'll have to wait for the daylight terminator to come
back round your way again. :-)

Regards,
-scott

On Fri, 2006-05-19 at 16:42 +1000, Ian Holsman wrote:
> Hi.
> 
> I wrote that app, and it does work (for me at least)
> 
> some of the main problems I have had in the past with it is the lack  
> of dependant libraries.
> you need
> 
> pycaptcha
> and
> Imaging
> and
> pycrypto (if you want to use the register app in that SVN)
> 
> If you want, feel free to ping me on irc (my nick is firemansam) or  
> Skype: iholsman / gtalk: kryton _at_ gmail.com
> and we'll get it sorted out for you. (and post back the answer here  
> for next time)
> 
> On 19/05/2006, at 12:47 PM, Scott Anderson wrote:
> 
> >
> > Hi all,
> >
> > I'm a new Django user trying to get the captcha app working with svn
> > Django.
> >
> > I've done the following:
> >
> > 1) Placed the captcha app in my site directory (which is named  
> > 'craft')
> > 2) Added a reference to "craft.captcha" to INSTALLED_APPS in  
> > settings.py
> > 3) Placed {% load captcha %} and {% captcha %} in my template (in
> > user/templates/register.html)
> > 4) Included the craft.captcha.urls reference in the site's urls.py for
> > ^captcha/
> >
> >
> > When I visit the register template, however, I get the following  
> > error:
> >
> > 'captcha' is not a valid tag library: Could not load template library
> > from django.templatetags.captcha, cannot import name template
> >
> >> From the "load captcha" line in the template.
> >
> > I'm sure I'm missing something simple, but I'm not familiar enough  
> > with
> > Django yet to figure out what it is. I've also tried "load
> > craft.captcha", but no dice.
> >
> > Thanks for any help in advance,
> > -scott
> >
> >
> >
> > >
> 
> 
> > 


--~--~-~--~~~---~--~~
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: Problem with Django Captcha

2006-05-18 Thread Ian Holsman

Hi.

I wrote that app, and it does work (for me at least)

some of the main problems I have had in the past with it is the lack  
of dependant libraries.
you need

pycaptcha
and
Imaging
and
pycrypto (if you want to use the register app in that SVN)

If you want, feel free to ping me on irc (my nick is firemansam) or  
Skype: iholsman / gtalk: kryton _at_ gmail.com
and we'll get it sorted out for you. (and post back the answer here  
for next time)

On 19/05/2006, at 12:47 PM, Scott Anderson wrote:

>
> Hi all,
>
> I'm a new Django user trying to get the captcha app working with svn
> Django.
>
> I've done the following:
>
> 1) Placed the captcha app in my site directory (which is named  
> 'craft')
> 2) Added a reference to "craft.captcha" to INSTALLED_APPS in  
> settings.py
> 3) Placed {% load captcha %} and {% captcha %} in my template (in
> user/templates/register.html)
> 4) Included the craft.captcha.urls reference in the site's urls.py for
> ^captcha/
>
>
> When I visit the register template, however, I get the following  
> error:
>
> 'captcha' is not a valid tag library: Could not load template library
> from django.templatetags.captcha, cannot import name template
>
>> From the "load captcha" line in the template.
>
> I'm sure I'm missing something simple, but I'm not familiar enough  
> with
> Django yet to figure out what it is. I've also tried "load
> craft.captcha", but no dice.
>
> Thanks for any help in advance,
> -scott
>
>
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with Django Captcha

2006-05-18 Thread Scott Anderson

Hi all,

I'm a new Django user trying to get the captcha app working with svn
Django.

I've done the following:

1) Placed the captcha app in my site directory (which is named 'craft')
2) Added a reference to "craft.captcha" to INSTALLED_APPS in settings.py
3) Placed {% load captcha %} and {% captcha %} in my template (in
user/templates/register.html)
4) Included the craft.captcha.urls reference in the site's urls.py for
^captcha/


When I visit the register template, however, I get the following error:

'captcha' is not a valid tag library: Could not load template library
from django.templatetags.captcha, cannot import name template

>From the "load captcha" line in the template. 

I'm sure I'm missing something simple, but I'm not familiar enough with
Django yet to figure out what it is. I've also tried "load
craft.captcha", but no dice.

Thanks for any help in advance,
-scott



--~--~-~--~~~---~--~~
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: Django captcha problems

2006-03-02 Thread Luis Armendariz

syhpoon wrote:
> Error occurs when I try to load template with form that is protected
> with captcha, i.e. when I put {%load captcha%} {%captcha%} into my
> template, without these lines it renders fine, but, naturally without
> captcha image. The strangest thing for me is that, as I've mentioned
> before, with django internal server it works as it required to: the
> image is generated and shown, validation passes as well. Thus I suspect
> mod_python to be the cause of errors like these. But the reason, and
> much more important, solution is still unknown.
> 
> Template code I use for this form is taken from captcha's class
> docstring.
> 
> 
> 

Hi Syhpoon,

I'm not too familiar with the captchas, but shouldn't you use the
template tags {% load captcha %} and {% captcha %} instead? The leading
and trailing spaces are important, I think.

-Luis

--~--~-~--~~~---~--~~
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: Django captcha problems

2006-03-02 Thread syhpoon

Error occurs when I try to load template with form that is protected
with captcha, i.e. when I put {%load captcha%} {%captcha%} into my
template, without these lines it renders fine, but, naturally without
captcha image. The strangest thing for me is that, as I've mentioned
before, with django internal server it works as it required to: the
image is generated and shown, validation passes as well. Thus I suspect
mod_python to be the cause of errors like these. But the reason, and
much more important, solution is still unknown.

Template code I use for this form is taken from captcha's class
docstring.


--~--~-~--~~~---~--~~
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: Django captcha problems

2006-03-01 Thread Ian Holsman

Hi Syhpoon.

the captcha should work fine, (it did the last time I tried it with
the TRUNK, i've been focusing on other spots lately)

is it complaiing like this when you are fetching the image, or when
you are generating
the page with the fields, or when you post the data back to it?

if you could email me your template (privately if you wish) I can try
to reproduce it on my setup.

Regards
Ian.


On 3/2/06, syhpoon <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I've tried django captcha
> (http://feh.holsman.net/articles/2005/12/15/django-captcha-app) but got
> strange behaviour:
> With internal django web server everything works just fine, but I got a
> really misterious error with apache 2.0.55 and mod_python 3.1.4
> on FreeBSD (sorry for a lot of quoting, I'm not really sure what's the
> call that caused error):
> Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> Traceback (most recent call last):
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py",
> line 299, in HandlerDispatch
> result = object(req)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/handlers/modpython.py",
> line 169, in handler
> return ModPythonHandler()(req)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/handlers/modpython.py",
> line 143, in __call__
> response = self.get_response(req.uri, request)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 109, in get_response
> return self.get_technical_error_response(request)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 139, in get_technical_error_response
> return debug.technical_500_response(request, *sys.exc_info())
>
>   File "/usr/local/lib/python2.4/site-packages/django/views/debug.py",
> line 126, in technical_500_response
> return HttpResponseServerError(t.render(c), mimetype='text/html')
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 146, in render
> return self.nodelist.render(context)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 714, in render
> bits.append(self.render_node(node, context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 727, in render_node
> return(node.render(context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
> line 112, in render
> nodelist.append(node.render(context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
> line 174, in render
> return self.nodelist_true.render(context)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 714, in render
> bits.append(self.render_node(node, context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 727, in render_node
> return(node.render(context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
> line 112, in render
> nodelist.append(node.render(context))
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 772, in render
> output = self.filter_expression.resolve(context)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
> line 599, in resolve
> obj = func(obj, *arg_vals)
>
>   File
> "/usr/local/lib/python2.4/site-packages/django/core/template/defaultfilters.py",
> line 434, in pprint
> return pformat(value)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 59, in pformat
> return PrettyPrinter(indent=indent, width=width,
> depth=depth).pformat(object)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 110, in pformat
> self._format(object, sio, 0, 0, {}, 0)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 128, in _format
> rep = self._repr(object, context, level - 1)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 194, in _repr
> self._depth, level)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 206, in format
> return _safe_repr(object, context, maxlevels, level)
>
>   File "/usr/local/lib/python2.4/pprint.py", line 291, in _safe_repr
> rep = repr(object)
>
>   File "/usr/local/lib/py

Re: Django captcha problems

2006-03-01 Thread syhpoon

Yes, I do use prefork mpm


--~--~-~--~~~---~--~~
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: Django captcha problems

2006-03-01 Thread Jeremy Dunck

On 3/1/06, syhpoon <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I've tried django captcha
> (http://feh.holsman.net/articles/2005/12/15/django-captcha-app) but got
> strange behaviour:
> With internal django web server everything works just fine, but I got a
> really misterious error with apache 2.0.55 and mod_python 3.1.4
> on FreeBSD (sorry for a lot of quoting, I'm not really sure what's the
> call that caused error):
> Mod_python error: "PythonHandler django.core.handlers.modpython"

Are you using the pre-fork MPM for Apache?  If not, try it; you'll like it.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django captcha problems

2006-03-01 Thread syhpoon

Hi,
I've tried django captcha
(http://feh.holsman.net/articles/2005/12/15/django-captcha-app) but got
strange behaviour:
With internal django web server everything works just fine, but I got a
really misterious error with apache 2.0.55 and mod_python 3.1.4
on FreeBSD (sorry for a lot of quoting, I'm not really sure what's the
call that caused error):
Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py",
line 299, in HandlerDispatch
result = object(req)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 169, in handler
return ModPythonHandler()(req)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 143, in __call__
response = self.get_response(req.uri, request)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",
line 109, in get_response
return self.get_technical_error_response(request)

  File
"/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py",
line 139, in get_technical_error_response
return debug.technical_500_response(request, *sys.exc_info())

  File "/usr/local/lib/python2.4/site-packages/django/views/debug.py",
line 126, in technical_500_response
return HttpResponseServerError(t.render(c), mimetype='text/html')

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 146, in render
return self.nodelist.render(context)

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 714, in render
bits.append(self.render_node(node, context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 727, in render_node
return(node.render(context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
line 112, in render
nodelist.append(node.render(context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
line 174, in render
return self.nodelist_true.render(context)

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 714, in render
bits.append(self.render_node(node, context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 727, in render_node
return(node.render(context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/defaulttags.py",
line 112, in render
nodelist.append(node.render(context))

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 772, in render
output = self.filter_expression.resolve(context)

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/__init__.py",
line 599, in resolve
obj = func(obj, *arg_vals)

  File
"/usr/local/lib/python2.4/site-packages/django/core/template/defaultfilters.py",
line 434, in pprint
return pformat(value)

  File "/usr/local/lib/python2.4/pprint.py", line 59, in pformat
return PrettyPrinter(indent=indent, width=width,
depth=depth).pformat(object)

  File "/usr/local/lib/python2.4/pprint.py", line 110, in pformat
self._format(object, sio, 0, 0, {}, 0)

  File "/usr/local/lib/python2.4/pprint.py", line 128, in _format
rep = self._repr(object, context, level - 1)

  File "/usr/local/lib/python2.4/pprint.py", line 194, in _repr
self._depth, level)

  File "/usr/local/lib/python2.4/pprint.py", line 206, in format
return _safe_repr(object, context, maxlevels, level)

  File "/usr/local/lib/python2.4/pprint.py", line 291, in _safe_repr
rep = repr(object)

  File "/usr/local/lib/python2.4/UserDict.py", line 162, in __repr__
return repr(dict(self.iteritems()))

  File "/usr/local/lib/python2.4/UserDict.py", line 100, in iteritems
for k in self:

  File "/usr/local/lib/python2.4/UserDict.py", line 87, in __iter__
for k in self.keys():

  File "/usr/local/lib/python2.4/shelve.py", line 98, in keys
return self.dict.keys()

AttributeError: DbfilenameShelf instance has no attribute 'dict'

---
It occurs only when I put {% load captcha %} {%captcha %} into
template, it works perfectly without though.

Any ideas?
Thanks.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---