Skip to content

Commit f927ea2

Browse files
ben-beauhurstclaudep
authored andcommitted
Added a check for instance._state.adding to instance_pre_save as checking not instance.pk is insufficient. It can have a PK but not be saved in the DB yet, which will call this to fail.
1 parent 3dbe55f commit f927ea2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linkcheck/listeners.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def delete_instance_links(sender, instance, **kwargs):
132132

133133

134134
def instance_pre_save(sender, instance, raw=False, **kwargs):
135-
if not instance.pk or raw:
135+
if instance._state.adding or not instance.pk or raw:
136136
# Ignore unsaved instances or raw imports
137137
return
138138
current_url = instance.get_absolute_url()

0 commit comments

Comments
 (0)