class ChannelDB(TypedObject): """ This is the basis of a comm channel, only implementing the very basics of distributing messages. The Channel class defines the following database fields beyond the ones inherited from TypedObject: - db_account_subscriptions: The Account subscriptions. - db_object_subscriptions: The Object subscriptions. """ db_account_subscriptions = models.ManyToManyField( "accounts.AccountDB", related_name="account_subscription_set", blank=True, verbose_name="account subscriptions", db_index=True, ) db_object_subscriptions = models.ManyToManyField( "objects.ObjectDB", related_name="object_subscription_set", blank=True, verbose_name="object subscriptions", db_index=True, ) # Database manager objects = managers.ChannelDBManager() __settingclasspath__ = settings.BASE_CHANNEL_TYPECLASS __defaultclasspath__ = "evennia.comms.comms.DefaultChannel" __applabel__ = "comms" class Meta(object): "Define Django meta options" verbose_name = "Channel" verbose_name_plural = "Channels" def __str__(self): "Echoes the text representation of the channel." return "Channel '%s' (%s)" % (self.key, self.db.desc) @lazy_property def subscriptions(self): return SubscriptionHandler(self)
class ChannelDB(TypedObject): """ This is the basis of a comm channel, only implementing the very basics of distributing messages. The Channel class defines the following properties: key - main name for channel desc - optional description of channel aliases - alternative names for the channel permissions - perm strings """ db_subscriptions = models.ManyToManyField("players.PlayerDB", related_name="subscription_set", null=True, verbose_name='subscriptions', db_index=True) db_object_subscriptions = models.ManyToManyField( "objects.ObjectDB", related_name="object_subscription_set", null=True, verbose_name='subscriptions', db_index=True) # Database manager objects = managers.ChannelDBManager() __settingclasspath__ = settings.BASE_CHANNEL_TYPECLASS __defaultclasspath__ = "evennia.comms.comms.DefaultChannel" class Meta: "Define Django meta options" verbose_name = "Channel" verbose_name_plural = "Channels" def __str__(self): return "Channel '%s' (%s)" % (self.key, self.db.desc) @lazy_property def subscriptions(self): return SubscriptionHandler(self)