Re: [Django] #29320: No exception when an Annotation alias matches a ForeignKey attname

2018-04-12 Thread Django
#29320: No exception when an Annotation alias matches a ForeignKey attname
-+-
 Reporter:  Flávio Juvenal   |Owner:  Flávio
 |  Juvenal
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Flávio Juvenal:

Old description:

> Looks like the solution for "#11256 Fail loudly and clearly when an
> Annotation alias matches a field name" doesn't consider foreign keys
> {{{attname}}}s, e.g. {{author_id}}.
>
> Here's a failing test, add it to aggregation_regress/tests.py:
> {{{
> #!python
> def test_fk_attname_conflict(self):
> msg = "The annotation 'contact_id' conflicts with a field on the
> model."
> with self.assertRaisesMessage(ValueError, msg):
> Book.objects.annotate(contact_id=F('publisher_id'))
> }}}
>
> PR here: https://github.com/django/django/pull/9873/files

New description:

 Looks like the solution for "#11256 Fail loudly and clearly when an
 Annotation alias matches a field name" doesn't consider foreign keys
 {{{attname}}}s, e.g. {{{author_id}}}.

 Here's a failing test, add it to aggregation_regress/tests.py:
 {{{
 #!python
 def test_fk_attname_conflict(self):
 msg = "The annotation 'contact_id' conflicts with a field on the
 model."
 with self.assertRaisesMessage(ValueError, msg):
 Book.objects.annotate(contact_id=F('publisher_id'))
 }}}

 PR here: https://github.com/django/django/pull/9873/files

--

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.9ca849637735accfafa43c6e6ce17ae5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29320: No exception when an Annotation alias matches a ForeignKey attname

2018-04-12 Thread Django
#29320: No exception when an Annotation alias matches a ForeignKey attname
-+-
 Reporter:  Flávio Juvenal   |Owner:  Flávio
 |  Juvenal
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Flávio Juvenal):

 * owner:  Flávio Juvenal => Flávio Juvenal


Old description:

> Looks like the solution for "#11256 Fail loudly and clearly when an
> Annotation alias matches a field name" doesn't consider foreign keys
> {{{attname}}}s, e.g. {{author_id}}.
>
> Here's a failing test, add it to aggregation_regress/tests.py:
> {{{
> #!python
> def test_fk_id_name_conflict(self):
> msg = "The annotation 'contact_id' conflicts with a field on the
> model."
> with self.assertRaisesMessage(ValueError, msg):
> Book.objects.annotate(contact_id=F('publisher_id'))
> }}}
>
> I'll make a PR soon.

New description:

 Looks like the solution for "#11256 Fail loudly and clearly when an
 Annotation alias matches a field name" doesn't consider foreign keys
 {{{attname}}}s, e.g. {{author_id}}.

 Here's a failing test, add it to aggregation_regress/tests.py:
 {{{
 #!python
 def test_fk_attname_conflict(self):
 msg = "The annotation 'contact_id' conflicts with a field on the
 model."
 with self.assertRaisesMessage(ValueError, msg):
 Book.objects.annotate(contact_id=F('publisher_id'))
 }}}

 PR here: https://github.com/django/django/pull/9873/files

--

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.e0f2c41ba7ce94e6b1e7523ec1d1fbbe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.