Re: [Django] #31310: Wrong hint about recursive relationship.

2020-02-28 Thread Django
#31310: Wrong hint about recursive relationship.
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  Matheus
 Type:   |  Cunha Motta
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"308fab924195bdea2fc481e1466c3c3894c03400" 308fab92]:
 {{{
 #!CommitTicketReference repository=""
 revision="308fab924195bdea2fc481e1466c3c3894c03400"
 Refs #31310 -- Added test for check for using intermediate model with
 ambiguous foreign key from model.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.d6435a3a64371697d003688e982d9f7d%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship.

2020-02-28 Thread Django
#31310: Wrong hint about recursive relationship.
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  Matheus
 Type:   |  Cunha Motta
  Cleanup/optimization   |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"e908eb62871f0b0aac63afa6601bf222bc2a1a7d" e908eb6]:
 {{{
 #!CommitTicketReference repository=""
 revision="e908eb62871f0b0aac63afa6601bf222bc2a1a7d"
 Fixed #31310 -- Fixed hints in checks for using intermediate model with
 ambiguous foreign key.

 symmetrical=False is not required since
 87b1ad6e7351464c60e751b483d9dfce3a2d3382.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.751813fbc0295a4cc0921116cec39255%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship.

2020-02-27 Thread Django
#31310: Wrong hint about recursive relationship.
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  Matheus
 Type:   |  Cunha Motta
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by felixxm):

 * needs_tests:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.5156a54090bef4ad72ae20025bc0bdaa%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship. (was: Wrong hint about recursive relationship)

2020-02-27 Thread Django
#31310: Wrong hint about recursive relationship.
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  Matheus
 Type:   |  Cunha Motta
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by felixxm):

 * owner:  nobody => Matheus Cunha Motta
 * status:  new => assigned
 * version:  3.0 => master
 * needs_tests:  0 => 1


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.aa0e82dc914a366e090483fd8181f12e%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship

2020-02-26 Thread Django
#31310: Wrong hint about recursive relationship
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by Simon Charette):

 * has_patch:  0 => 1
 * stage:  Unreviewed => Accepted


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.022a6e9154737fdd6b4c64a44751a1f4%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship

2020-02-26 Thread Django
#31310: Wrong hint about recursive relationship
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Description changed by Matheus Cunha Motta:

Old description:

> When there's more than 2 ForeignKeys pointing to the same model in an
> intermediary model of a m2m field and no through_fields have been set,
> Django will show an error with the following hint:
>   {{{#!python
> hint=(
> 'If you want to create a recursive relationship, '
> 'use ForeignKey("%s", symmetrical=False, through="%s").'
>   }}}
> But to create a recursive relationship the ManyToManyField should be used
> instead of ForeignKey. Also symmetrical=False should only be used with
> m2m fields, according to model field reference (link:
> https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.ManyToManyField.symmetrical).
> And more than that, setting symmetrical=False is not required for
> recursive relationships since Django >= 3.0.
>
> This was probably a small mistake where the developer thought
> ManyToManyField but typed ForeignKey instead. And the symmetrical=False
> is an outdated requirement to recursive relationships, not applicable
> since 3.0. I'll provide a PR with a proposed correction shortly after.

New description:

 When there's more than 2 ForeignKeys in an intermediary model of a m2m
 field and no through_fields have been set, Django will show an error with
 the following hint:
   {{{#!python
 hint=(
 'If you want to create a recursive relationship, '
 'use ForeignKey("%s", symmetrical=False, through="%s").'
   }}}
 But 'symmetrical' and 'through' are m2m keyword arguments, not ForeignKey.

 This was probably a small mistake where the developer thought
 ManyToManyField but typed ForeignKey instead. And the symmetrical=False is
 an outdated requirement to recursive relationships with intermediary model
 to self, not required since 3.0. I'll provide a PR with a proposed
 correction shortly after.

 Edit: fixed description.

--

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.ca5c4fd78ead29872cb4bae3581129a7%40djangoproject.com.


Re: [Django] #31310: Wrong hint about recursive relationship

2020-02-26 Thread Django
#31310: Wrong hint about recursive relationship
-+-
 Reporter:  Matheus Cunha Motta  |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-

Comment (by Matheus Cunha Motta):

 Here's a PR: https://github.com/django/django/pull/12497

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.f74a96a974fb1df76a71ae4121596836%40djangoproject.com.


[Django] #31310: Wrong hint about recursive relationship

2020-02-26 Thread Django
#31310: Wrong hint about recursive relationship
-+-
   Reporter:  Matheus|  Owner:  nobody
  Cunha Motta|
   Type: | Status:  new
  Cleanup/optimization   |
  Component:  Database   |Version:  3.0
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  1
  UI/UX:  0  |
-+-
 When there's more than 2 ForeignKeys pointing to the same model in an
 intermediary model of a m2m field and no through_fields have been set,
 Django will show an error with the following hint:
   {{{#!python
 hint=(
 'If you want to create a recursive relationship, '
 'use ForeignKey("%s", symmetrical=False, through="%s").'
   }}}
 But to create a recursive relationship the ManyToManyField should be used
 instead of ForeignKey. Also symmetrical=False should only be used with m2m
 fields, according to model field reference (link:
 
https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.ManyToManyField.symmetrical).
 And more than that, setting symmetrical=False is not required for
 recursive relationships since Django >= 3.0.

 This was probably a small mistake where the developer thought
 ManyToManyField but typed ForeignKey instead. And the symmetrical=False is
 an outdated requirement to recursive relationships, not applicable since
 3.0. I'll provide a PR with a proposed correction shortly after.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.f996317f736a339cdf1290c0e1a8e59f%40djangoproject.com.