@@ -3303,19 +3303,13 @@ def handle_defaults(self, article):
33033303@receiver (pre_delete , sender = FrozenAuthor )
33043304def remove_author_from_article (sender , instance , ** kwargs ):
33053305 """
3306+ This signal is triggered before a FrozenAuthor is deleted.
33063307 This signal will remove an author from a paper if the user deletes the
33073308 frozen author record to ensure they are in sync.
33083309 :param sender: FrozenAuthor class
33093310 :param instance: FrozenAuthor instance
33103311 :return: None
33113312 """
3312- if (not instance .article .authors .exists ()) and (
3313- not ArticleAuthorOrder .objects .filter (article = instance .article ).exists ()
3314- ):
3315- # Return early so long as deprecated models and fields are not being used.
3316- # This avoids triggering the deprecation warning in development.
3317- return
3318- warnings .warn ("Authorship is now exclusively handled via FrozenAuthor." )
33193313 try :
33203314 ArticleAuthorOrder .objects .get (
33213315 author = instance .author ,
@@ -3331,7 +3325,8 @@ def remove_author_from_article(sender, instance, **kwargs):
33313325 except ArticleAuthorOrder .DoesNotExist :
33323326 pass
33333327
3334- instance .article .authors .remove (instance .author )
3328+ if instance .article and instance .article .authors .exists ():
3329+ instance .article .authors .remove (instance .author )
33353330
33363331
33373332def order_keywords (sender , instance , action , reverse , model , pk_set , ** kwargs ):
@@ -3359,6 +3354,7 @@ def backwards_compat_authors(
33593354 sender , instance , action , reverse , model , pk_set , ** kwargs
33603355):
33613356 """A signal to make the Article.authors backwards compatible
3357+ This signal is triggered when the Article-Account many-to-many table changes.
33623358 As part of #4755, the dependency of Article on Account for author linking
33633359 was removed. This signal is a backwards compatibility measure to ensure
33643360 FrozenAuthor records are being updated correctly.
0 commit comments