def model(self):

        T = current.T
        db = current.db

        define_table = self.define_table

        #----------------------------------------------------------------------
        # Super entity: msg_channel
        #
        channel_types = Storage(msg_email_channel = T("Email (Inbound)"),
                                msg_facebook_channel = T("Facebook"),
                                msg_mcommons_channel = T("Mobile Commons (Inbound)"),
                                msg_rss_channel = T("RSS Feed"),
                                msg_sms_modem_channel = T("SMS Modem"),
                                msg_sms_webapi_channel = T("SMS WebAPI (Outbound)"),
                                msg_sms_smtp_channel = T("SMS via SMTP (Outbound)"),
                                msg_tropo_channel = T("Tropo"),
                                msg_twilio_channel = T("Twilio (Inbound)"),
                                msg_twitter_channel = T("Twitter"),
                                )

        tablename = "msg_channel"
        self.super_entity(tablename, "channel_id",
                          channel_types,
                          Field("name",
                                #label = T("Name"),
                                ),
                          Field("description",
                                #label = T("Description"),
                                ),
                          Field("enabled", "boolean",
                                default = True,
                                #label = T("Enabled?")
                                #represent = s3_yes_no_represent,
                                ),
                          # @ToDo: Indicate whether channel can be used for Inbound or Outbound
                          #Field("inbound", "boolean",
                          #      label = T("Inbound?")),
                          #Field("outbound", "boolean",
                          #      label = T("Outbound?")),
                          )

        # @todo: make lazy_table
        table = db[tablename]
        table.instance_type.readable = True

        # Reusable Field
        channel_id = S3ReusableField("channel_id", tablename % "reference %s",
                                     label = T("Channel"),
                                     ondelete = "SET NULL",
                                     represent = S3Represent(lookup=tablename),
                                     requires = IS_EMPTY_OR(
                                        IS_ONE_OF_EMPTY(db, "msg_channel.id")),
                                     )

        self.add_components(tablename,
                            msg_channel_status = "channel_id",
                            )

        # ---------------------------------------------------------------------
        # Channel Limit
        #  Used to limit the number of emails sent from the system
        #  - works by simply recording an entry for the timestamp to be checked against
        #
        # - currently just used by msg.send_email()
        #
        tablename = "msg_channel_limit"
        define_table(tablename,
                     # @ToDo: Make it per-channel
                     #channel_id(),
                     *s3_timestamp())

        # ---------------------------------------------------------------------
        # Channel Status
        #  Used to record errors encountered in the Channel
        #
        tablename = "msg_channel_status"
        define_table(tablename,
                     channel_id(),
                     Field("status",
                           #label = T("Status"),
                           #represent = s3_yes_no_represent,
                           represent = lambda v: v or current.messages["NONE"],
                           ),
                     *s3_meta_fields())

        # ---------------------------------------------------------------------
        return dict(msg_channel_id = channel_id,
                    msg_channel_enable = self.channel_enable,
                    msg_channel_disable = self.channel_disable,
                    msg_channel_enable_interactive = self.channel_enable_interactive,
                    msg_channel_disable_interactive = self.channel_disable_interactive,
                    msg_channel_onaccept = self.channel_onaccept,
                    msg_channel_poll = self.channel_poll,
                    )

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3db/msg.py/S3ChannelModel.model/swapped operands of `%`