1

When trying to save the data in the DB I have this error:

sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.

models.py

class Movie(Model):
    title = CharField(max_length=255)
    omdb = JSONField()
    slug = SlugField(max_length=255, unique=True, allow_unicode=True)

views.py

omdb_data = get_movie(title) # returns response.json() from external API call
print(type(omdb_data['Title'])) # str
        print(type(omdb_data)) # dict
        movie = Movie(title=omdb_data['Title'],
                      omdb=omdb_data, slug=slugify(title))
        movie.save() # crashing here

What could be wrong? I'm guess it's problem with title or omdb parameters (not sure if ID counts or not) but no idea whats wrong.

1
  • from where are you importing the **JSONField ** ? Commented Mar 2, 2019 at 16:27

1 Answer 1

1

SQLite doesn't support all types data. It's in its name (Lite). You may try to convert to PostgreSQL or another complete database solution. Here is a tutorial for Django+Postgres but be careful, it's little bit outdated.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.