rafalp / django-ember-issues

Issue tracker for state of Django & Ember.js development
MIT License
1 stars 0 forks source link

Initialising Ember.js application with data from Django #4

Open rafalp opened 9 years ago

Tyrdall commented 9 years ago

@rafalp Any resources? Would be exactly what I need. =)

rafalp commented 9 years ago

I've created dict on request object that contains preloaded data. My middlewares and views may add keys on this dict, which is on render turned into json and assigned to window.PreloadedData = {{data|json}}:

https://github.com/rafalp/Misago/blob/master/misago/templates/misago/preloaded_data.js

In Ember.js I have custom "PreloadStore" utility class that lets me reach to this data, and from there I may use it wherever I want:

https://github.com/rafalp/Misago/blob/master/misago/emberapp/app/utils/preloadstore.js

However, this is only basic solution for a problem, and it will need changes to eventually support serialized models that I could push to Ember-data (vide authenticated user or current ACL).

Tyrdall commented 9 years ago

@rafalp Thanks a lot!