Re: UniqueConstraint raises uncaught IntegrityError in Admin

2019-07-17 Thread Michael Barr
That's what I had to revert to doing, yes. I added logic to the validate_unique() method on the model itself and then updated the query logic manually. On Wednesday, July 17, 2019 at 2:15:52 AM UTC-4, Derek wrote: > > Would it be correct to say that adding validation at model clean level > woul

Re: UniqueConstraint raises uncaught IntegrityError in Admin

2019-07-15 Thread Michael Barr
Yeah, this one just bit me in the Django Admin as well. According to the docs , Validation of Constraints > > In general constraints are *not* checked during full_clean(), and do not > raise ValidationErrors. Rather you’ll get a data

Re: OuterRef not being treated as an F Expression

2018-03-01 Thread Michael Barr
For what it is worth, it has been confirmed as a bug and fixed: https://code.djangoproject.com/ticket/29142 On Friday, February 9, 2018 at 7:52:50 AM UTC-5, Michael Barr wrote: > > According to the documentation on models.OuterRef > <https://docs.djangoproject.com/en/2.0/ref/models

models.OuterRef('date') + timedelta(days=2) error

2018-02-09 Thread Michael Barr
class SampleModel(models.Model): date = models.DateField() value = models.IntegerField() subquery = SampleModels.objects.filter( date__gte=models.OuterRef('date') - timedelta(days=2), date__lte=models.OuterRef('date') + timedelta(days=2), value__lte=30 ) queryset = SampleModel.o

OuterRef not being treated as an F Expression

2018-02-09 Thread Michael Barr
According to the documentation on models.OuterRef : It acts like an F > > expression > except that the