class UserOption(Model): """ User options apply only to a user, and optionally a project. Options which are specific to a plugin should namespace their key. e.g. key='myplugin:optname' Keeping user feature state key: "feature:assignment" value: { updated: datetime, state: bool } """ user = FlexibleForeignKey(settings.AUTH_USER_MODEL) project = FlexibleForeignKey('sentry.Project', null=True) key = models.CharField(max_length=64) value = UnicodePickledObjectField() objects = UserOptionManager() class Meta: app_label = 'sentry' db_table = 'sentry_useroption' unique_together = (( 'user', 'project', 'key', ), ) __repr__ = sane_repr('user_id', 'project_id', 'key', 'value')
class OrganizationOption(Model): """ Organization options apply only to an instance of a organization. Options which are specific to a plugin should namespace their key. e.g. key='myplugin:optname' key: onboarding:complete value: { updated: datetime } """ __core__ = True organization = FlexibleForeignKey('sentry.Organization') key = models.CharField(max_length=64) value = UnicodePickledObjectField() objects = OrganizationOptionManager() class Meta: app_label = 'sentry' db_table = 'sentry_organizationoptions' unique_together = (( 'organization', 'key', ), ) __repr__ = sane_repr('organization_id', 'key', 'value')
class Option(Model): """ Global options which apply in most situations as defaults, and generally can be overwritten by per-project options. Options which are specific to a plugin should namespace their key. e.g. key='myplugin:optname' """ key = models.CharField(max_length=64, unique=True) value = UnicodePickledObjectField() last_updated = models.DateTimeField(default=timezone.now) class Meta: app_label = 'sentry' db_table = 'sentry_option' __repr__ = sane_repr('key', 'value')
class ProjectOption(Model): """ Project options apply only to an instance of a project. Options which are specific to a plugin should namespace their key. e.g. key='myplugin:optname' """ project = FlexibleForeignKey('sentry.Project') key = models.CharField(max_length=64) value = UnicodePickledObjectField() objects = ProjectOptionManager() class Meta: app_label = 'sentry' db_table = 'sentry_projectoptions' unique_together = (('project', 'key',),) __repr__ = sane_repr('project_id', 'key', 'value')