How to Dynamically Add More to a List

You did not need to change the NumberInput in the form to IntegerField. You only needed to remove it from the class definition.

1 Like

After several days of trying to fix the error and heavy assistance from @KenWhitesell , I realized that the issue is simply due to sqlite database. I tested exactly the same code on postgresql and everything works perfectly as expected. Please if you ever have a similar issue like this, firstly try changing your database to advanced ones such as postgresql and make sure that all the previous migration were deleted before performing migrate and makemigration on the new database.

I think you’re drawing the wrong conclusion from what you’re seeing.

I would like to know what happens if you delete the db.sqlite3 file you were previously using and start from scratch.

I’m much more inclined to believe you had something wrong than it being a SQLite issue.

Sincerely speaking, I did nothing extra than that. I’ve also experienced similar issue some months back on one of my project, I wanted to install a module using pip, during an attempt to make migrations and migrate I noticed that it was showing database error(different from this one though) after several attempts to fix this and still having the same error, I decided to test the project on postgresql and everything works well.

Yes, but have you tried deleting the db.sqlite file and restarting from scratch?

Because that’s what you effectively have done by changing database engines. You’ve gone from a database that might have some stuff left in it from previous work to a brand new clean database.

I’ve been using sqlite in production-status deployments for more than 5 years now, and have never had a problem that wasn’t self-inflicted in some way or another - and I’m not the only person to do so.

So no, I do not accept your answer as the “issue is simply due to sqlite database”. You do a disservice to the Django community by suggesting that without evidence that this is the case.

Initially, I have deleted SQLite database after deleting the previous migration, I made migrations which also gave me exactly the same error. If you try to install django_notification_system, after making migrations and migrate, it will instantly show some errors which will not make me run the server, if you delete the SQLite database and also the previous migration then try installing the module you will still get the error (from my own observation), the error was gone only after when I tried PostgreSQL I experienced exactly the same issue here and was fixed in the same manner.

I cannot recreate the issue you’re describing. I start from a clean system, do a startproject followed by a startapp; create one trivial model; do a makemigrations followed by a migrate then a runserver. Everything works as expected.
I installed and configured django_notification_system (django-notification-system ¡ PyPI) and likewise, no problems at all.
Therefore, I must conclude that you still have something misconfigured within your project and that the issue you’re reporting is not caused by there being anything wrong with either Django or Sqlite.
I’ll also point out that since you’ve got (at least) one third-party module involved, it is also possible that there are problems within that module, or potential conflicts between that module and other modules - which is a different situation entirely. It might be valid to say that “module xyz has a problem with Sqlite”, but that doesn’t mean that the problem is within Sqlite.

1 Like