Cannot save ManyToMany fields from Django Admin interface

My sqllite3 database and Django setup are working correctly except for this single situation involving the Admin interface:

class Box(models.Model):
    name = models.CharField(max_length=200, primary_key=True)
    balls = models.ManyToManyField( 'Ball' )

class Ball(models.Model):
    name = models.CharField(max_length=200, primary_key=True)

I have a ManyToMany field in my Box model to contain multiple Ball models. I can create some Balls and I can even create a Box and link it to some Balls. But I cannot edit/save the Box's set of balls after it's been created without getting this server error:

DatabaseError : unable to open database file

I am using the development server (python manage.py runserver). Apart from this admin glitch, database IO works fine across my site.

Things I have tried which have not helped: 1. Deleting the database and running syncdb again to start fresh. 2. Set my db path in settings.py to a full path. 3. Running the shell I start the dev server from 'As Administrator' 4. Setting the parent, folder and db file permissions as RW

I don't know what else to try. I'm open to crazy suggestions, but hoping somebody might know what could cause this...


UPDATE:

I got it working!

I suspected that this was an issue with sqllite3 database. Perhaps it's lack of transactional updates... I can't say for sure. So I swapped the database out for MySQL and the issue is now gone. I can create 'boxes' and add 'balls' to them now.

Answers


Need Your Help

Continue Program execution even after try catch

c# .net exception-handling oop

When I use try, catch blocks, if any exception is throws the program execution is stopped after the catch is handled. But, I need to continue the program execution even if there is exception. Can a...

Pass Numpy Array without copy using pyzmq

python arrays numpy multiprocessing pyzmq

So I need to be able to efficiently work on large numpy arrays in multiple processes. This requires not copying the data. Also, the arrays won't be available before fork, so they'll need to be passed

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.