Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSONField for object repr field #298

Open
sgordon16 opened this issue Jul 24, 2024 · 3 comments · May be fixed by #299
Open

Use JSONField for object repr field #298

sgordon16 opened this issue Jul 24, 2024 · 3 comments · May be fixed by #299

Comments

@sgordon16
Copy link

sgordon16 commented Jul 24, 2024

Is there any reason why we can't use JSONField instead of TextField for object_json_repr? It would allow for querying within the json for specific logs.

https://docs.djangoproject.com/en/5.0/ref/models/fields/#jsonfield

@jheld
Copy link
Collaborator

jheld commented Jul 24, 2024

I guess we probably can since django 3.1 was the first version to include universal JSON support on all supported db backends. Before that, we couldn't. Open to creating a PR?

@sgordon16 sgordon16 linked a pull request Jul 25, 2024 that will close this issue
@sgordon16
Copy link
Author

PR #299

@sgordon16
Copy link
Author

sgordon16 commented Jul 25, 2024

Side question. Is there a reason why object_json_repr is stored in a list?
It's a bit un-intuitive to have to add the 0 to query the json. CRUDEvent.objects.filter(object_json_repr__0__model="app.model")

object_json_repr = serializers.serialize("json", [instance])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants