You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
2 years ago | |
|---|---|---|
| LeStorage | 2 years ago | |
| LeStorage.xcodeproj | 2 years ago | |
| LeStorageTests | 2 years ago | |
| .gitignore | 2 years ago | |
| README.md | 2 years ago | |
README.md
LeStorage
1. RULES
- To store data in the json format inside files,
you first need to create some model class, for example
Car - You make
CarinheritModelObject, and implementStorable - To get the
StoredCollectionthat manages all your cars and stores them for you, you doStore.main.registerCollection()to retrieve a collection.
2. Sync
- When registering your collection, you can choose to have it synchronized. To do that:
- Set
Store.main.synchronizationApiURL - Pass
synchronized: truewhen registering the collection
- Set
- For each of your
ModelObject, make sure thatresourceName()returns the resource path of the endpoint, for example "cars" - Synchronization is expected to be done with a rest_framework API on a django server
- On Django, when using cascading delete foreign, you'll want to avoid sending useless delete API calls to django, so override the
deleteDependenciesfunction of your ModelObject and callStore.main.deleteDependenciesfor the objects you also want to delete to reproduce the cascading effect - On your Django serializers, you want to define the following on your foreign keys to avoid having a URL instead of just the id:
car_id = serializers.PrimaryKeyRelatedField(queryset=Car.objects.all())