I looked at the source of Tastypie, and my conclusion is as follows.
You can try to measure your resource and change the value of the excludes attribute on the fly when the POST method, but it will be difficult and, most importantly, to crack.
Therefore, I think that itβs best to do what you are doing, but perhaps instead of doing a few del bundle[ 'field' ] , introduce the post_excludes attribute or some of them and implement a more convenient and flexible way to get rid of these fields For example, you can do something like this:
class YourResource( Resource ): class Meta:
This would be cleaner and consistent with Tastypie's rules, which are important not to end with confusing, cracked code that is hard to maintain.
Hope this helps :)
source share