diff --git a/zephyr/forms.py b/zephyr/forms.py index 05a62c0f8e..803b9dd56b 100644 --- a/zephyr/forms.py +++ b/zephyr/forms.py @@ -17,7 +17,7 @@ def is_unique(value): def is_inactive(value): try: - if get_user_profile_by_email(value).user.is_active: + if get_user_profile_by_email(value).is_active: raise ValidationError(u'%s is already active' % value) except UserProfile.DoesNotExist: pass diff --git a/zephyr/lib/actions.py b/zephyr/lib/actions.py index 4db5768cb2..90ba251649 100644 --- a/zephyr/lib/actions.py +++ b/zephyr/lib/actions.py @@ -68,7 +68,7 @@ def do_create_user(email, password, realm, full_name, short_name, full_name=user_profile.full_name)), users=[up.id for up in UserProfile.objects.select_related().filter(realm=user_profile.realm, - user__is_active=True)]) + is_active=True)]) tornado_callbacks.send_notification(notice) return user_profile @@ -115,7 +115,7 @@ def do_deactivate(user_profile): full_name=user_profile.full_name)), users=[up.id for up in UserProfile.objects.select_related().filter(realm=user_profile.realm, - user__is_active=True)]) + is_active=True)]) tornado_callbacks.send_notification(notice) @@ -203,7 +203,7 @@ def do_send_message(message, rendered_content=None, no_log=False, message.save() ums_to_create = [UserMessage(user_profile=user_profile, message=message) for user_profile in recipients - if user_profile.user.is_active] + if user_profile.is_active] for um in ums_to_create: sent_by_human = message.sending_client.name.lower() in \ ['website', 'iphone', 'android'] @@ -784,7 +784,7 @@ def do_events_register(user_profile, apply_markdown=True, event_types=None): 'full_name' : profile.full_name} for profile in UserProfile.objects.select_related().filter(realm=user_profile.realm, - user__is_active=True)] + is_active=True)] if event_types is None or "subscription" in event_types: ret['subscriptions'] = gather_subscriptions(user_profile) diff --git a/zephyr/management/commands/banish_broken.py b/zephyr/management/commands/banish_broken.py index 096f0dbdaa..a7539a4b16 100644 --- a/zephyr/management/commands/banish_broken.py +++ b/zephyr/management/commands/banish_broken.py @@ -6,7 +6,7 @@ from zephyr.models import Realm, UserProfile # Helper to be used with manage.py shell to get rid of bad users on prod. def banish_busted_users(change=False): for u in UserProfile.objects.select_related().all(): - if (u.user.is_active or u.realm.domain != "mit.edu"): + if (u.is_active or u.realm.domain != "mit.edu"): continue (banished_realm, _) = Realm.objects.get_or_create(domain="mit.deleted") if "|mit.edu@mit.edu" in u.email.lower(): diff --git a/zephyr/management/commands/populate_db.py b/zephyr/management/commands/populate_db.py index cc9fbafa5a..6d30d8a954 100644 --- a/zephyr/management/commands/populate_db.py +++ b/zephyr/management/commands/populate_db.py @@ -582,7 +582,7 @@ def restore_saved_messages(): recipient_user_ids.add(message.sender_id) for user_profile_id in recipient_user_ids: - if users_by_id[user_profile_id].user.is_active: + if users_by_id[user_profile_id].is_active: um = UserMessage(user_profile_id=user_profile_id, message=message) user_messages_to_create.append(um) diff --git a/zephyr/management/commands/update_mit_fullnames.py b/zephyr/management/commands/update_mit_fullnames.py index 1cc6fb834f..f83856d66a 100644 --- a/zephyr/management/commands/update_mit_fullnames.py +++ b/zephyr/management/commands/update_mit_fullnames.py @@ -7,7 +7,7 @@ from zephyr.lib.actions import compute_mit_user_fullname # Helper to be used with manage.py shell to fix bad names on prod. def update_mit_fullnames(change=False): for u in UserProfile.objects.select_related().all(): - if (u.user.is_active or u.realm.domain != "mit.edu"): + if (u.is_active or u.realm.domain != "mit.edu"): # Don't change fullnames for non-MIT users or users who # actually have an account (is_active) and thus have # presumably set their fullname how they like it. diff --git a/zephyr/management/commands/user_stats.py b/zephyr/management/commands/user_stats.py index faea669cf6..c55a7fdc15 100644 --- a/zephyr/management/commands/user_stats.py +++ b/zephyr/management/commands/user_stats.py @@ -24,7 +24,7 @@ class Command(BaseCommand): for realm in realms: print realm.domain - user_profiles = UserProfile.objects.filter(realm=realm, user__is_active=True) + user_profiles = UserProfile.objects.filter(realm=realm, is_active=True) print "%d users" % (len(user_profiles),) print "%d streams" % (len(Stream.objects.filter(realm=realm)),) diff --git a/zephyr/views.py b/zephyr/views.py index 8d6af2dcc2..eddeeaac0e 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -120,7 +120,7 @@ def send_signup_message(sender, signups_stream, user_profile, internal=False): user_profile.email, internal_blurb, UserProfile.objects.filter(realm=user_profile.realm, - user__is_active=True).count(), + is_active=True).count(), ) )