This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
readme.txt
79 lines (44 loc) · 2.24 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Django Lawnchair
--------------------------------
This is a way to try and make managing django models easier in the client. It's just a wrapper
around Lawnchair: http://brianleroux.github.com/lawnchair/ which is a client side JSON document
store.
This is a 0.1, god I'd be surprised if this so much as worked.
Basically it tries to make easier with the sample libraries:
- getting data from Django, stuffing it into Lawnchair
- figuring out what data has changed in Lawnchair and pushing it back to Django
As such its pretty raw, but it might just work.
Mostly this is focused on the example that shows a sample to do application might work, if we
needed yet more buggy simple little to do apps (we don't).
To install the example:
- make sure you have lawnchair JS on your site (http://brianleroux.github.com/lawnchair/)
- make sure you have jquery JS on your site (http://jquery.com)
- add in django-lawnchair into your Python path (python setup.py install)
- add in example into your Django project
- add in "example" and "lawnchair" into your INSTALLED_APPS
Give it a play at /todo/list.
Your own project:
- basically you need to make three views on your model: get, save and delete. These will be need
to be hooked by yourself in your URLs as you see fit, for example:
url(r'^list/get/$', "example.views.get", name="todo-get"),
url(r'^list/save/$', "example.views.save", name="todo-save"),
url(r'^list/delete/$', "example.views.delete", name="todo-delete"),
- for each of those get, save and delete views there is a utility that will take the corresponding
object or objects. eg:
return get(objects), or delete(obj)
In the javascript end of things:
- var futon = new djangochair('/todo/list');
- to create a djangochair pointing at /todo/list... it will then append get, save, delete etc on to the end
- next:
futon.remote_get(callback)
This will call "get" and for each model returned, load them into the local client side database.
Then you can call futon.update to alter your records.
- then
futon.updated(function(r) {
futon.remote_save(r);
});
Will run through and find every changed object and push them back into Django.
To do:
- gosh there's a lot to do
- make the syncing smarter
- django-piston