Re: models.CalculatedField feature

2017-11-15 Thread Shai Berger
On Thursday 16 November 2017 07:21:38 Josh Smeaton wrote: > > I don't agree with reimplementing lookups/transforms/funcs to produce the > python version of a SQL concept. It's a leaky abstraction. Instead, I'd > prefer the model author provides their python calculation: > > is_adult = models.

Re: models.CalculatedField feature

2017-11-15 Thread Josh Smeaton
I too have seen computed properties poorly implemented as model functions/properties, only some of the time matched with an appropriate database selector. I think there's a lot of merit in the idea. I don't agree with reimplementing lookups/transforms/funcs to produce the python version of a SQ

Django 2.0 release candidate 1 released

2017-11-15 Thread Tim Graham
We've made the final (hopefully) release on the way to Django's next major release, Django 2.0! Check out the blog post: https://www.djangoproject.com/weblog/2017/nov/15/django-20-release-candidate-1-released/ -- You received this message because you are subscribed to the Google Groups "Django

Re: models.CalculatedField feature

2017-11-15 Thread Anthony King
Hey, this is something I'd like to get involved in. Last year I began prototyping something (albeit with an awful name) that resembled sqlalchemy's hybrid properties. I'll spend a bit of time in a few hours sprucing it up to better match their naming, and link it here if anyone is interested. On

RE: models.CalculatedField feature

2017-11-15 Thread Tom Forbes
SQLAlchemy has this, through a feature called Hybrid Attributes: http://docs.sqlalchemy.org/en/latest/orm/extensions/hybrid.html Every Django project i've worked on has had to tackle this problem, often poorly. You usually end up with an instance method and a kind of duplicate manager method, or s

RE: models.CalculatedField feature

2017-11-15 Thread Matthew Pava
I handle that situation quite differently. I have a model manager that annotates different fields to the queryset depending on when I need them. For your example, I would have something like this: class CustomerQuerySet(models.QuerySet): def with_allowed_to_drink(self): return self.anno

models.CalculatedField feature

2017-11-15 Thread ilya . kazakevich
Hello. I think I just invented very useful feature. I have the following model class Customer(models.Model): age = models.IntegerField() I want to show special link in template for customer if she is allowed to drink. class Customer(models.Model): age = models.IntegerField() @prop

Testing admin inlines painful to debug ("ManagementForm data is missing or has been tampered with")

2017-11-15 Thread Federico Capoano
While writing tests for the admin, I'm clashing with this error message: "ManagementForm data is missing or has been tampered with". It's not the first time I do this, but every time the process has been extremely painful because the error message doesn't point out the exact problem. This time

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Bernhard Posselt
Ah right, this issue probably also affects the admin login. I see no other way than to use a webserver extension then. On 15.11.17 12:32, Adam Johnson wrote: https://github.com/jsocol/django-ratelimit is good at this, and it's well maintained so you shouldn't have any problems with upgrading.

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Bernhard Posselt
Thanks, will take a look at the webserver extensions and the django-ratelimit extension :) The Trac ticket doesn't look like it's going to be worked on in the near future. On 15.11.17 12:32, Adam Johnson wrote: https://github.com/jsocol/django-ratelimit is good at this, and it's well mainta

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Adam Johnson
https://github.com/jsocol/django-ratelimit is good at this, and it's well maintained so you shouldn't have any problems with upgrading. It's already tested on Django 2.0. I agree though that it would be best for security if contrib.auth did it out of the box. But there are lots of reasons why it's

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Riccardo Magliocchetti
Il 15/11/2017 12:07, Bernhard Posselt ha scritto: Hi guys, We've received a report from hackerone.com that our password change and login forms are not protected against brute forcing passwords. Since we re-use both the built-in password change and login form views from Django it feels like rat

Re: Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Jani Tiainen
Hi, There exists ticket already in Trac: https://code.djangoproject.com/ticket/21289 On 15.11.2017 13.07, Bernhard Posselt wrote: Hi guys, We've received a report from hackerone.com that our password change and login forms are not protected against brute forcing passwords. Since we re-use b

Rate limiting failed login attempts/failed password changes

2017-11-15 Thread Bernhard Posselt
Hi guys, We've received a report from hackerone.com that our password change and login forms are not protected against brute forcing passwords. Since we re-use both the built-in password change and login form views from Django it feels like rate limiting for these views should work out of the