I am unable to get a symmetrical, self-referencing ManyToManyField with a
through table to actually be symmetrical, at least through the Admin
interface. I am using Django 3.0 so it looks like the capability is
supported.
Models:
class Contact(models.Model):
last_name = models.TextField(d
Mike, Thanks for your suggestions.
Just a stab in the dark - have you tried giving from_contact a
> related_name?
>
Yes, I have tried a few different combinations of providing a single
related_name and various naming conventions when providing related_name on
both ForeignKey fields without s
On Thursday, June 25, 2020 at 10:26:25 AM UTC-4, Dan Madere wrote:
>
> I tried out the example code, and can replicate this. What's interesting
> is that if I try removing the ContactConnection model, and the "through"
> attribute, this allows Django to create the intermediate table on its own,
After reviewing the tests, I think I now understand what is going on.
Basically, for symmetric ManyToManyField, Django creates entries for both
directions automatically if the correct interface is used. From the test
models:
class PersonSelfRefM2M(models.Model):
name = models.CharField(max_
Nice solution. Thanks!
On Thursday, June 25, 2020 at 5:49:23 PM UTC-4, Dan Madere wrote:
>
> I don't know of a way to configure the admin do that, but one solution
> would be to use signals to notice when one-way records are created, then
> automatically create the record for reverse relationshi
5 matches
Mail list logo