我有以下模型:
class Websites(models.Model):
website_name = models.CharField(max_length=255,null=False)
website_json_data = JSONField(blank=True,null=True,default=dict)
def __str__(self):
return self.website_name
json_data
包含2个键:headers
[LIST]和body
[DICT],后面有很多json 对象
json_data = {"api.google.com": {"headers": ["Accept-User", "Mozilla","etc"], "body": "<html><title>sagsdgsdgsdgsdg</body>"},"api.facebook.com":{"headers":["Content-Type","User-Agent"],"body":"<html><title>this is facebook</title>"}
p = Websites.objects.create(website_name="google.com",website_json_data=json_data)
p.save()
在这种情况下如何过滤结果?
Q1)在这种情况下,如何基于body
包含的结果进行过滤?
EX:如果任何json对象主体包含this is facebook