Hi everyone. I've developed a django website of medium complexity
(about 50,000 lines of python), and the company I work for is now
asking for a subset of the functionality to be available on an iPad.

I'm familiar with iPad development, so I'm not worried about that, but
all the research I've done on keeping the databases synchronized has
basically boiled down to "it's hard, good luck" :)

I want people to be able to make updates, deletes, and additions to
the database on an iPad, and then later synchronize these changes with
the web server (sort of like omnifocus), while also getting any new
changes that have been made on the server side.   This is important
because the users won't always be connected to the internet.

Every solution I've sketched out has my head spinning trying to figure
out how to handle foreign keys properly, what to do if the sync dies
partway through, and so forth. The server database will always be
considered sacrosanct, so if two people edit the same object, the
server version should always win (I'd just present the iPad user with
a list of things that he "lost" on). This includes situations like the
iPad user deleting an object that had been updated on the server since
the last sync, etc.

Has anyone on this list ever tackled annoying like this?  All my
django objects keep track of creation and modification time. I have
lots of foreign keys and many to many relationships. One very simple
thing that needs to happen just to get started would be that the
pre_delete signal would need to copy / flag entries so that deletions
could later be handled in synchronization. The iPad must keep deleted
objects (or at least their pks) around until the next sync, and the
server needs to keep the pks somewhere so it can tell remote clients
about the deletions later. And it just gets more complex from there!

Another situation is if the iPad users creates a new object, and then
uses foreign keys to refer to it, the synchronization might change the
pk of the new object (since a new object with the same pk might have
been created on the server), so if that happens all those foreign keys
need to be fixed up on the iPad, and those implicit changes uploaded
to the server as well. Then if the app dies in the middle of that
process, it seems very very easy for one (or both!) of my quite large
databases to get in some inconsistent state that would be nearly
impossible to repair.

One of the things I'd like to avoid is having to make every single
many to many relationship have to use a custom "through" class just
for synchronization, since that makes the admin interface less nice
without adding any real functionality to the web users.

Am I screwed?  Should I dust off my old silberschatz database book, or
is this easier than I think?

Sent from my iPad

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to