-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related fields (ForeignKey) models get saved for no reason. [Performance Issue] #397
Comments
I believe I am seeing this as well. It's a pretty basic structure, so https://gist.github.com/f3db0df350d0a4a7f5f2 causes the project to be saved. |
Not sure if this applies to this issue however I have to following problem: I have a resource ( Now whenever I send a non-GET request to the Is this my fault or something in tastypie not working right? |
I took some of @joshbohde's work and massaged it into a fix here: https://github.com/toastdriven/django-tastypie/pull/594 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1 |
++ |
…, django-tastypie#594 and others. Extra tests assuring through model metadata is saved; fixing backwards/forwards incompatability with MockRequest
While searching around I noticed something that got me feeling pretty uneasy.
What I noticed is that Tastypie goes and not only loads (which it needs for purpose of building reverse URI's) but also SAVES related models. Related in a sense of foreign key, where related models are merely being pointed to.
Consider the example provided below:
http://pastebin.com/F27w5Q6N
We have a parent model (EventResource), which has a child (CustomerResource) and two references (SiteResource,CustomerResourceResource). The child is provided inline and is expected to get updated/created. However Site and CustomerResource are not. For instance Site is the root model and that could cause congestion problems on a site with elevated loads and is bad for performance reasons, obviously.
The issue manifests itself in save_related model of ModelResource. To repeat the phenomena, set a breakpoint in the line 34 of this paste (http://pastebin.com/6FLwVLDk). Then step through and watch how related models get saved.
The code is from commit: toastdriven@600a033
I believe that this issue may be linked to:
https://github.com/toastdriven/django-tastypie/issues/371
and may be linked to:
https://github.com/toastdriven/django-tastypie/issues/390
The text was updated successfully, but these errors were encountered: