I was recently using django and i ran into a problem. I have created some models and have added then to the admin panel for adding data to the sqldb. One of my model have a JSONField and i have set its default value as dict. Now when I am creating an object from admin, I leave this JSONField value to be {} itself. Not changing the default value. Now when i try to access that purticular model instance using its relation with its parent model, it gives DoesNotExist error. That object is not geting created as long as i nake any changes to the given default value. Can any one tell why i would be facing such a case?
You need to provide more specific information here.
You need to post the models, and the code that is trying to reference those models, along with the complete traceback with the error message for the error being thrown.
It would also help if you posted sample data that you are trying to use here.
Side note: When posting code or error messages here, enclose the code for each file between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code (or error message), then another line of ```. This forces the forum software to keep your code properly formatted.
1 Like