Skip to content

Commit

Permalink
adding self reference PR
Browse files Browse the repository at this point in the history
  • Loading branch information
safwanrahman committed Aug 28, 2018
1 parent 33e4157 commit f46abb5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions readthedocs/core/signals.py
Expand Up @@ -81,6 +81,7 @@ def delete_projects_and_organizations(sender, instance, *args, **kwargs):
# Here we count the owner list from the projects that the user own
# Then exclude the projects where there are more than one owner
# Add annotate before filter
# https://github.com/rtfd/readthedocs.org/pull/4577
# https://docs.djangoproject.com/en/2.1/topics/db/aggregation/#order-of-annotate-and-filter-clauses # noqa
projects = (Project.objects.annotate(num_users=Count('users')).filter(users=instance.id)
.exclude(num_users__gt=1))
Expand Down

0 comments on commit f46abb5

Please sign in to comment.