When creating a new Rule and testing its query before saving it, an error like this was happening:
'Rule' instance needs to have a primary key value before this relationship can
be used.
From the user's perspective, the test was not happening and the server returned a 500 error.
When testing a new Rule that has not been saved, a temporary Rule object is created in memory. Since that object is not saved, it does not contain a primary key.
Due to some changes introduced in Django 4, errors are thrown if that object without a primary key is used. To fix that issue, we manually assign a primary key.
When creating a new Rule and testing its query before saving it, an error like this was happening:
From the user's perspective, the test was not happening and the server returned a 500 error.
When testing a new Rule that has not been saved, a temporary Rule object is created in memory. Since that object is not saved, it does not contain a primary key.
Due to some changes introduced in Django 4, errors are thrown if that object without a primary key is used. To fix that issue, we manually assign a primary key.