#31435: RecursionError when deleting a model with one to many relationship.
-------------------------------------+-------------------------------------
     Reporter:  Fabian Allendorf     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:
  delete,model,recursion,stack,overflow,reference,foreign,key,one,to,many|  
Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Judging by the trace of the exception it seems like you already forked
 `django-timeseries` or are using a different package with the same name
 since the Pypi ones doesn't have a `models.py` file.

 In all cases your code was broken because you are accessing a deferred
 field in your `TimeSeries.__init__` model which is not allowed.

 You can test it out but on any version of Django doing
 `TimeSeries.objects.defer('frequency')` would cause `N + 1` queries to be
 performed where `N = TimeSeries.objects.count()`.

 You want to do `self._old_frequency = self.__dict__.get('frequency')` in
 there.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31435#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.275b670d4766953eaca3e378cef4e755%40djangoproject.com.

Reply via email to