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.


Job opportunity: Django Developer, Newark on Trent, UK

2017-03-28 Thread Christian Ledermann
This is an exceptional opportunity to be a key part of a team of eight
developers and three sysadmins at PrimarySite, the leading provider of
primary school websites.

About PrimarySite

We’re a 60 person company formed over ten years ago who build great
products for primary schools to save them time and money, whilst
enabling them to communicate more effectively with parents. Our office
is located in the centre of Newark, with easy access to both train
stations and the A1.

About the team

You would be joining us as a member of the Product Development team,
working on-site with the Product Owner. We use the Kanban methodology,
and support several different applications — mostly built as
micro-services.

Our team’s work is of a high quality — every line of code is peer
reviewed and there is a minimum requirement of 90% test coverage. We
constantly work to improve our processes and currently score a 10 out
of 12 on the Joel Test

What you’d bring to the team:

At least 3 years of building web applications with Python.
Experience in delivering products in an agile environment.
The ability to write well structured and thoroughly tested code.
A solid understanding of software design patterns, providing
well-architected solutions to complex problems.

We’d welcome further skills in the following areas:

Django
React or similar front-end framework
REST APIs
Redis
Varnish
Postgres
Celery

In return we’ll provide:

A laptop of your choosing
An adjustable standing desk and Aeron chair
Flexible working
Childcare vouchers
Contribution pension scheme
Cycle to work scheme
Time for side projects to expand your skill set
Conference and training opportunities
Social events
Up to 34 days annual leave


If you’re interested in working with us, please send a covering letter
and CV to j...@primarysite.net.


https://primarysite.net/about-us/django-dev/

-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

-- 
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/CABCjzWryAuz2QNRzvOseLo77j0nOS3N5FHPmQv6qTDvv%2BP5aUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Update dict JsonField Postgresql

2017-03-28 Thread Melvyn Sopacua
On Monday 27 March 2017 15:03:17 Martin Peveri wrote:
> Perfect!! This code works:
> 
> data = objectitem.data
> 
> data[0]['processed'] = True
> 
> objectitem.data = data
> 
> objectitem.save()
> 
> A last query that is not related to the insertion, but to the query.
> 
> If I want to get only records processed in True as I have to do?
> 
> This does not work, I get all the records:
> 
> objectitem.filter(data__contains=[{'processed': True}])

Looking at your data model, you should probably make data an ArrayField of 
JSONFields...
This would simplify things quite a bit.

That said, I would try data__contains={'processed': True}, but if that doesn't 
work, 
your problem is that your outer structure is a list, not an object, making 
filtering a lot 
harder.

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


Re: Update dict JsonField Postgresql

2017-03-28 Thread Martin Peveri
It does not work :(

With ArrayField Will I be able to filter the content of the field?. For 
example, if i have one record and in the field data a list of dict with 
50k. Can I filter it?. That is to say, to bring only in the array the 
records with 'processed' true.

Thanks! 

El martes, 28 de marzo de 2017, 6:58:51 (UTC-3), Melvyn Sopacua escribió:
>
> On Monday 27 March 2017 15:03:17 Martin Peveri wrote:
>
> > Perfect!! This code works:
>
> > 
>
> > data = objectitem.data
>
> > 
>
> > data[0]['processed'] = True
>
> > 
>
> > objectitem.data = data
>
> > 
>
> > objectitem.save()
>
> > 
>
> > A last query that is not related to the insertion, but to the query.
>
> > 
>
> > If I want to get only records processed in True as I have to do?
>
> > 
>
> > This does not work, I get all the records:
>
> > 
>
> > objectitem.filter(data__contains=[{'processed': True}])
>
>  
>
> Looking at your data model, you should probably make data an ArrayField of 
> JSONFields...
>
> This would simplify things quite a bit.
>
>  
>
> That said, I would try data__contains={'processed': True}, but if that 
> doesn't work, your problem is that your outer structure is a list, not an 
> object, making filtering a lot harder.
>
>  
>
> -- 
>
> 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/403307f0-2cf6-4e73-b979-558c279a1450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django sample projects

2017-03-28 Thread Melvyn Sopacua
On Monday 27 March 2017 09:27:59 Shahab Emami wrote:
> hello
> 
> i have question:
> where can i find a few django sample projects?

Mezzanine[1] and Cartridge[2] probably fit the bills best. Mezzanine comes with 
it's 
own mezzanine-project command, which creates a project and after running 
createdb 
is a fully functional site with user accounts, blog, gallery and editable pages.

In the end though, a Django project is a collection of apps tied to urls. If 
you can write 
an app, all you need to do is tie them to urls and add the homepage and global 
navigation.
-- 
Melvyn Sopacua


[1] http://mezzanine.jupo.org/
[2] http://cartridge.jupo.org/

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


Re: Django signup problem Urgent

2017-03-28 Thread Melvyn Sopacua
On Monday 27 March 2017 20:19:11 Babatunde Akinyanmi wrote:
> Hello Idowu.
> You were supposed to include your stack trace so that there can be a
> proper diagnosis of the problem. Now we can only guess.
> 
> I guess you are submitting your form with the `description` field
> empty because your defined it with `blank=True` in your models.py.

Wrong diagnosis. You would not get a "field is required" message, but "this 
field cannot 
be null" (which comes from the model layer, not the form layer).

The problem is two-fold:
1) You're trying to do everything yourself that's already abstracted. Use at 
minimum 
generic.FormView[1] 
2) The image field: it is required and you're not passing request.FILES to the 
form.

And maybe a third: encoding type of the form should be set correctly.
-- 
Melvyn Sopacua


[1] https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/FormView/

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


python-social-auth-django for Twitter

2017-03-28 Thread Mike Ru
I'm using python-social-auth-django. I' trying to login with Twitter. It 
works. But some symbols are added to my nickname. Why is it happening?

-- 
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/0512ea7d-d2b7-4687-8357-e1fea0611769%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.