I’m trying to include 2 public keys to the same model. Searching through posts indicates this is a common problem, resolved by using a related name for a least one field. However, I’m still getting an error:
<class ‘actionlog.admin.ActionInstanceInline’>: (admin.E202) ‘actionlog.Action’ has more than one ForeignKey to ‘actionlog.Audit’.
I must be doing something dumb but I’d appreciate any help. The models are:
audit_ref = models.CharField(
max_length=5, help_text=‘Unique audit ref YY_xx, e.g. 21_01 (max length 5 chars)’)
lead_auditor = models.ForeignKey(‘LeadAuditor’, on_delete=models.SET_NULL, null=True)
“”“Model for individual actions”""
action_ref = models.CharField(max_length=3, help_text=‘Action ref e.g. 01 or 12b (max 3 chars)’)
action_title = models.CharField(max_length=100, help_text=‘Action title (max 100 chars)’)
Foreign key used because actions can only have one audit
Pass as a string rather than object because these haven’t yet been declared in the file
audit_ref = models.ForeignKey(‘Audit’, on_delete=models.CASCADE)
lead_auditor = models.ForeignKey(
‘Audit’, on_delete=models.CASCADE, related_name=‘lead_auditors’)