gregmuellegger / django-autofixture

Can create auto-generated test data.
BSD 3-Clause "New" or "Revised" License
462 stars 118 forks source link

Fix email constraint. InvalidConstraint need a model field, not a string #77

Closed qtdzz closed 8 years ago

qtdzz commented 8 years ago

A small and very rare bug when generating user model.

gregmuellegger commented 8 years ago

Hi thanks for the proposal. Can you describe very quickly when you hit this bug? I don't get yet what this PR is changing in the semantics.

qtdzz commented 8 years ago

Hi, The bug happens when the generated email is not unique. Actually it is very rare (or impossible) to reach this bug. I recognized it when I referenced "unique_email" to make my own constraint. But when my constraint is not satisfied, it was crashed instead of raising InvalidConstraint. I took a look at the constraints.py and found that it takes a model field as parameter, not a string. Thanks for your consideration :)

gregmuellegger commented 8 years ago

Oops, I didn't see that. This went unnoticed since 2010 :) Thanks for the fix and the explanation.

gregmuellegger commented 8 years ago

Do you need a new release with this fix urgently? Otherwise it will just be part of the next random release :)

qtdzz commented 8 years ago

Hi, I think you don't need to make a new release because it may never reach that bug. It is just helpful for people who refer that point to make their own constraints :+1: