nasaonacid / abstractAardvark

0 stars 0 forks source link

Creation of custom .create() method on TreeSerializer #18

Closed nasaonacid closed 9 years ago

nasaonacid commented 9 years ago

http://www.django-rest-framework.org/topics/3.0-announcement/#serializers

Rest doesn't support writable nested serializers by default so a custom create(and possibly update) method is needed to allow for the creation of a new game via api calls. Above link contains an example

nasaonacid commented 9 years ago

Creation for tree serializer needed a customs node create also. Due to the structure of MPTT you need to refer to the parent of the node and cannot explicitly create children. Create for node now has an optional parent field to allow for a recursive creation of the tree passing the currently created node when creating children. Testing will need to be done to see if this method supports incorrect children on the root node or if there is a 500 error.