Check if authorization has accesscodes attribute
@@ -1387,6 +1387,7 @@ class SendReadyApplicationsView(PartnerCoordinatorOnly, DetailView):
auth = Authorization.objects.get(
user=application.user, partners=application.partner
)
+ if hasattr(auth, "accesscodes"):
if auth.accesscodes:
logger.info(
"Authorization already has an access code, reassigning it...."
@@ -1399,6 +1400,8 @@ class SendReadyApplicationsView(PartnerCoordinatorOnly, DetailView):
code_object.authorization = auth
else:
code_object.authorization = auth
+ else:
+ code_object.authorization = auth
code_object.save()
