#36480: FieldError when referencing a nonexistent alias provides less 
information
than nonexistent annotation
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:
         Type:                       |  houston0222
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  typo                 |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by houston0222):

 Hi everyone, I’ve tested the change that the reporter suggested (replacing
 **self.annotation_select** with **self.annotations**). I think it works
 well — including alias names in the “Choices are:” part of the FieldError
 message makes the error more helpful and consistent with how `.annotate()`
 behaves. This can really help catch typos or make things clearer when
 switching from `.annotate()` to `.alias()`.

 I understand the concern about showing aliases in cases like
 `.aggregate(),` where they aren’t valid. But I still think it’s helpful to
 include them — that seems better than hiding the alias completely.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36480#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070197ad3015cb-626b30f2-1d80-4a5c-a099-18f1b3aa8ab9-000000%40eu-central-1.amazonses.com.

Reply via email to