class PluginConfigurationReference(KongProxyModel): api = models.ForeignKey( APIReference, related_name='plugins', help_text=_('The API on which to add a plugin configuration')) consumer = models.ForeignKey( 'ConsumerReference', null=True, blank=True, related_name='plugins', help_text= _('The consumer that overrides the existing settings for this specific consumer on incoming requests.' )) plugin = enum.EnumField( Plugins, default=Plugins.REQUEST_SIZE_LIMITING, help_text=_( 'The name of the Plugin that\'s going to be added. Currently the Plugin must be installed in every Kong ' 'instance separately.')) enabled = models.BooleanField(default=True) config = JSONField( default={}, help_text=_( 'The configuration properties for the Plugin which can be found on the plugins documentation page in the ' 'Plugin Gallery.')) objects = JSONAwareManager(json_fields=['config']) class Meta: verbose_name = _('Plugin Configuration Reference') verbose_name_plural = _('Plugin Configuration References') unique_together = [('plugin', 'api')] def __str__(self): return text_type(Plugins.label(self.plugin))
class Request(Requests): meta = JSONField() client = models.ForeignKey(User, related_name='requests') endpoint = models.ForeignKey(Endpoint, related_name='requests') api = models.ForeignKey(Api, related_name='requests') def __unicode__(self): return '[%s] %s %s %s' % (self.time, self.method, self.path, self.response)
class QueryJsonModel(models.Model): code = models.CharField( blank=False, null=False, max_length=20 ) status = models.CharField( blank=True, null=True, max_length=20 ) info = JSONField(default={}) objects = JSONAwareManager(json_fields = ['info']) def __str__(self): return self.code class Meta: app_label = 'jsonfield2'
class Endpoint(models.Model): request_path = models.CharField(max_length=255, blank=False, null=False, verbose_name='path') active = models.BooleanField(default=True) schema = JSONField() api = models.ForeignKey(Api, related_name='apis') class Meta: verbose_name = "Endpoint" verbose_name_plural = "Endpoints" def __str__(self): self.request_path def __unicode__(self): self.request_path
class JSONFieldTestModel(models.Model): json = JSONField("test", null=True, blank=True) class Meta: app_label = 'jsonfield2'
class CallableDefaultModel(models.Model): json = JSONField(default=lambda: {'x': 2}) class Meta: app_label = 'jsonfield2'
class BlankJSONFieldTestModel(models.Model): null_json = JSONField(null=True) blank_json = JSONField(blank=True) class Meta: app_label = 'jsonfield2'
class JSONFieldWithDefaultTestModel(models.Model): json = JSONField(default={"sukasuka": "YAAAAAZ"}) class Meta: app_label = 'jsonfield2'