I think this should be an error personally - I'm not sure how we check that
effectively and efficiently.

It reminds me of asking postgres to cast a certain type to another one - it
will throw an error if any record it tries to cast can't be done.

Is it possible with say a CharField to not have a max_length parameter
here, even though you can't make a concrete field without it? If not then
we have another issue.

Marc

On 5 December 2014 at 06:15, Anssi Kääriäinen <[email protected]>
wrote:

> On Thu, 2014-12-04 at 18:04 -0800, Josh Smeaton wrote:
>
> >
> > I've implemented https://github.com/django/django/pull/3655/ which
> > effectively ignores the max_digits and decimal_places arguments in the
> > base expression class. Subclasses are free to enforce validation if it
> > is necessary. Further, callers using aren't required to supply bounds
> > checking in this situation.
>
> It seems wrong to throw away constraints the user has explicitly set.
> So, if you say:
>
>     .annotate(sum_age=Sum('age', output_field=DecimalField(max_digits=3)))
>
> then it seems that the max_digits should really be 3.
>
> So, if the user explicitly asks for max_digits=3 in the output_field
> argument, then we should enforce that. Or, alternatively we should
> disallow setting max_digits for explicit output_field in expressions.
> But just throwing away the value the user has explicitly set is wrong.
>
>  - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/1417760145.22478.72.camel%40TTY32
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMwjO1FHqFX0ZViVCQSDZRrFL6kBo07%3DR8hU0XTM-fV1CGb3%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to