mirror of
https://github.com/evennia/evennia.git
synced 2026-03-25 01:06:32 +01:00
17 lines
592 B
Python
17 lines
592 B
Python
"""
|
|
Custom manager for ConnectScreen objects.
|
|
"""
|
|
from django.db import models
|
|
|
|
class ConnectScreenManager(models.Manager):
|
|
def get_random_connect_screen(self):
|
|
"""
|
|
Returns a random active connect screen.
|
|
"""
|
|
try:
|
|
return self.filter(is_active=True).order_by('?')[0]
|
|
except IndexError:
|
|
new_screen = ConnectScreen(name='Default',
|
|
connect_screen_text='This is a placeholder connect screen. Remind your admin to edit it through the Admin interface.')
|
|
new_screen.save()
|
|
return new_screen
|