mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
Cut out duplicated code between clear_database and populate_db.
(imported from commit 4bb44c20d2f0477d8a3db72788f82b0cf8572b2d)
This commit is contained in:
@@ -16,6 +16,7 @@ from zephyr.lib.avatar import gravatar_hash
|
||||
import requests
|
||||
from django.contrib.auth.models import UserManager
|
||||
from django.utils import timezone
|
||||
from django.contrib.sessions.models import Session
|
||||
|
||||
@cache_with_key(lambda self: 'display_recipient_dict:%d' % (self.id))
|
||||
def get_display_recipient(recipient):
|
||||
@@ -616,3 +617,9 @@ def filter_by_subscriptions(messages, user):
|
||||
user_messages.append(message)
|
||||
|
||||
return user_messages
|
||||
|
||||
def clear_database():
|
||||
for model in [Message, Stream, UserProfile, User, Recipient,
|
||||
Realm, Subscription, Huddle, UserMessage, Client]:
|
||||
model.objects.all().delete()
|
||||
Session.objects.all().delete()
|
||||
|
||||
Reference in New Issue
Block a user