Skip to content
Advertisement

Tag: django-models

Import django models to custom python script

I am trying to create a custom python script within my Django application. This script requires the use of my app models. I am unable to figure out how to import the models appropriately to be used within this script. So if I wanted to access the pages.models from the custom_script.py how might I do this? I have attempted various

Update a field of a Django Object

I’m trying to update an object field in django. Usually I would do something like this: The problem is that the field to modify (in the example above: “name”) is not known and passed as an argument to the post request. So I would have something like this: now this triggers the error: What is the correct way to update

Django inspectdb omitted integer primary key

I have a legacy MySQL db, and I am trying to create Django models from it so I can use the legacy tables in my Django application. I ran inspectdb on the MySQL db and it seemed to import most fields correctly, but failed to import every single primary key and/or id field. Is this the expected behavior? I will

Advertisement