A Django based library to make django database reactive using Server Side Events .
Project description
=======
DbReact
=======
DbReact is simple but effective django app which makes any database defined within the project reactive
using SSE ( Server Side Events - no need to install anything for sse | its a http concept ).
The library provides any addition ,or deletion of objects in model ( row in rdms table ) ,in a json based protocol
( sends json structure of objects deleted and added ) to the client (Android ,Ios ,Web).
( On more Granular Level ) you can also make group of Model objects as reactive .
Quick start
-----------
1. Add middleware string in middleware list of your project (in settings.py):
MIDDLEWARE_CLASSES = [
...
'DbReactCreator.reactMiddle.reactiveMiddleware',
]
2. Import reactive decorator to views where you want to create the event pusher, and then create eventsource::
from DbReactCreator.reactDecorators import dbreact
...
@dbreact("unique_id_for_eventsource_in_string")
def pusher_function(request):
request.META['objects_to_be_reactive'] = Model.objects.all() | Model.objects.filter() ( always a list of queryset objects)
request.META['for_model'] = Model
return JsonResponse({},status=200)
3. Define a url for the view , and pass it to the client (mobile | web) .
4. As soon as client registers the url ,it starts getting json objects of the elements not present on its end.
* Format of data received by client :
{ add: [ json_serialized_queryset_object, ... ],
delete: [ json_serialized_queryset_object, ... ]
}
DbReact
=======
DbReact is simple but effective django app which makes any database defined within the project reactive
using SSE ( Server Side Events - no need to install anything for sse | its a http concept ).
The library provides any addition ,or deletion of objects in model ( row in rdms table ) ,in a json based protocol
( sends json structure of objects deleted and added ) to the client (Android ,Ios ,Web).
( On more Granular Level ) you can also make group of Model objects as reactive .
Quick start
-----------
1. Add middleware string in middleware list of your project (in settings.py):
MIDDLEWARE_CLASSES = [
...
'DbReactCreator.reactMiddle.reactiveMiddleware',
]
2. Import reactive decorator to views where you want to create the event pusher, and then create eventsource::
from DbReactCreator.reactDecorators import dbreact
...
@dbreact("unique_id_for_eventsource_in_string")
def pusher_function(request):
request.META['objects_to_be_reactive'] = Model.objects.all() | Model.objects.filter() ( always a list of queryset objects)
request.META['for_model'] = Model
return JsonResponse({},status=200)
3. Define a url for the view , and pass it to the client (mobile | web) .
4. As soon as client registers the url ,it starts getting json objects of the elements not present on its end.
* Format of data received by client :
{ add: [ json_serialized_queryset_object, ... ],
delete: [ json_serialized_queryset_object, ... ]
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-dbreact-0.3.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-dbreact-0.3.tar.gz.
File metadata
- Download URL: django-dbreact-0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2a5b7c4d67a2e3918601c4e120529b82948381ade14239ae94418546091016d
|
|
| MD5 |
1c7dc522231001e82510188cfed84401
|
|
| BLAKE2b-256 |
85df173d26fadb040b9cafd77361785fc186f88a26fea8fcf9574890615fba7d
|
File details
Details for the file django_dbreact-0.3-py2-none-any.whl.
File metadata
- Download URL: django_dbreact-0.3-py2-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9855c4ddc745bf9af33a16d44528c9ed208bc650585224da16aa87b5b1d31d9e
|
|
| MD5 |
d8a4c769793edba6c73269b230f4d70b
|
|
| BLAKE2b-256 |
dbd6826bb6f26b9b43b4b859a52e4c9608a6c06f7669c63e55e7e4a5d8d84df4
|