Beispiel #1
0
def purge_organizations():
    for organization in Organization.objects(deleted__ne=None):
        log.info('Purging organization "{0}"'.format(organization))
        # Remove followers
        FollowOrg.objects(following=organization).delete()
        # Remove activity
        Activity.objects(related_to=organization).delete()
        Activity.objects(organization=organization).delete()
        # Remove metrics
        Metrics.objects(object_id=organization.id).delete()
        organization.delete()
Beispiel #2
0
def purge_organizations(self):
    for organization in Organization.objects(deleted__ne=None):
        log.info('Purging organization "{0}"'.format(organization))
        # Remove followers
        FollowOrg.objects(following=organization).delete()
        # Remove activity
        Activity.objects(related_to=organization).delete()
        Activity.objects(organization=organization).delete()
        # Remove metrics
        Metrics.objects(object_id=organization.id).delete()
        # Remove
        organization.delete()
Beispiel #3
0
 def followers_org_count(self):
     """Return the number of followers of user's organizations."""
     from udata.models import FollowOrg  # Circular imports.
     return sum(FollowOrg.objects(following=org).count()
                for org in self.organizations)
Beispiel #4
0
 def followers_org_count(self):
     """Return the number of followers of user's organizations."""
     from udata.models import FollowOrg  # Circular imports.
     return sum(
         FollowOrg.objects(following=org).count()
         for org in self.organizations)