On Saturday, February 05, 2011 01:10:56 am Izz ad-Din Ruhulessin wrote:
> Hi all,
> 
> I've been theorizing about a Django Desktop Application built a GUI
> framework (eg. PyGTK, Tkinter).
> 
> It basically comes down with this:
> 
> 1. Login using an SSL POST request and create a user object.
> 
> 2. Download certain tables from the DB to the local machine, perhaps
> specified by a "download_local" attribute (True/False) on models. If
> it already is downloaded, synchronize it with the server.
> 
> 3. Use the Django ORM locally to do your work.
> 
> 4. Provide wrapper classes for the models save, delete methods etc.
> Foo.objects.get(pk=4) for example sends a POST request: {'obj': 'Foo',
> 'kwargs_keys': 'pk', 'kwargs_values': 4, 'op': 'get'}; the server then
> can do the job via get_model, getattr, etc.
> - OR - log all changes on the local machine, and provide a 'Send my
> work to the server'-button.
> 
> 
> This is my basic idea. What do you think about this? Is this the right
> approachs? And what would be possible pitfalls?
> 
> Kind regards,
> 
> Izz ad-Din Ruhulessin


If you only want to use the orm for the desktop appliction, I would suggest 
using sqlalchemy over django, much easier configuration and setup for a 
desktop application. I like to use sqlalchemy with PyQt, which does include a 
QtSql module. But it's more like PHP, you have to write all queries in SQL. 
The db table can be tossed back and forth with json still or use the orm's db 
settings to communicate with the server. While not advised for public apps, 
you can have the client talk directly with the db by passing a restful 
interface. Then you create a db user who has special permissions to the tables 
you want them to have access to.

I'm also not sure you're gaining anything this way. I think it would depend on 
the use. If you're aiming to make a data entry application, it would be easier 
to just do the communication and let the server handle all the work.  The 
application should validate before you send the data off, but gui libs provide 
nice tools for validation already, just implement those. And validate at the 
server end, always, especially if you're going with a restful style interface.

I also think you're approaching this idea the wrong way. The desktop 
application should be in pure django, with a script/batch file loading the 
page in the users browser. Then you get all of django's benefits. But even 
here, I still have my own doubts on the validity of it. This part is about 
wide-spread usage and what's the real benefit of this use? 

You could also build a simple browser with a notification area/systray icon 
for hiding the app off the desktop. 

I have previously played with this idea and these are some of the things I've 
come across, in the theory stage. The last question of benefit being the 
stopper from implementing it for desktop apps that work with a website/db. I 
just found it better and easier to implement it in a gui lib and use 
sqlalchemy to communicate with the server, or just skip the db part in the 
client and send off json, dumping the readied json to a pickle (or shelf) file  
when the network/user is not ready to send. When the network con is available 
read and send the data from the pickle file.

Mike





 
-- 
Look into my eyes and try to forget that you have a Macy's charge card!

-- 
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