Open 3hedgehogs opened 9 months ago
@3hedgehogs Could you provide some example code/a reproducible example? Would be great if you follow the template for bug report too.
Unfortunately I'm not a django programmer, just temporary support our internal project till we find a person to continue develop it.
Used models:
class HourlyLimit(mta_gui.models.MultiSettingsExtension, mta_gui.models.Model):
id = models.AutoField(db_column="limitid", primary_key=True)
source = models.ForeignKey(
to="pools.IpAddress",
on_delete=models.CASCADE,
db_column="OutPort",
to_field="outport",
related_name="hourly_limits",
)
destination = models.ForeignKey(
to="destinations.Destination",
on_delete=models.CASCADE,
db_column="DestinationId",
related_name="hourly_limits",
help_text="DEFAULT means limit is for all destinations",
)
value = models.IntegerField(
db_column="Value", default=0, help_text="0 means this public IP is disabled"
)
memo = models.TextField(db_column="Memo", blank=True, null=True)
...
class IpAddress(mta_gui.models.MultiSettingsExtension, mta_gui.models.Model):
id = models.AutoField(db_column="IpId", primary_key=True)
ip = models.CharField(db_column="Ip", max_length=60, unique=True)
ip_range = models.ForeignKey(
to="IpRange",
on_delete=models.CASCADE,
db_column="ipRangeId",
related_name="ip_addresses",
)
domain = models.CharField(db_column="Note", max_length=255)
outport = models.SmallIntegerField(db_column="OutPort", unique=True)
ip_pools = models.ManyToManyField(IpPool, related_name="ip_pools")
ip_pool = models.ForeignKey(
to="IpPool",
on_delete=models.SET_NULL,
db_column="IpPoolId",
blank=True,
null=True,
related_name="ip_addresses",
verbose_name="IP pool",
)
...
destination is returned correctly but source is always null for version 3.1.5
Sorry, if information is not enough I will close this issue
Unfortunately I'm not a django programmer, just temporary support our internal project till we find a person to continue develop it.
I see. Would definitely prefer a minimum reproducible example so we can create a test for it and see which change caused the issue, but I understand your situation. You can leave the issue open.
There're not a lot of PRs merged from 3.1.3
to 3.1.5
. I suspect it's due to either #1411 or #1446.
Version 3.1.3 and older versions are working correctly in situation if a field is a foreign key to a non PK of pointed table. 3.1.5 returns 'null'