Wednesday, October 30, 2019

Re: __init__ method called every time on same APIView object

Hi, 
Show some example of code ....

On Wed, Oct 30, 2019 at 5:08 PM Diana María Bedoya Ramírez <dbedoya@ikono.com.co> wrote:
Hello,

I have an APIView object with an __init__method. In that __init__ I have a loop that extends a class list variable. Every time I make a POST to the url that calls the APIView, the items in the loop items are added to the old ones in the list, duplicating the item number every time. 

Why is the __init__ method called on the same object with every request? How can assure a new object with every requesdt I make?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/452af061-bf26-4a2a-9437-eea482f951e1%40googlegroups.com.


--
Juan 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJK1Jg2%2BzY%3DiEqWbYJuAZkXkoCsr%3Dj_jbY5J9TAA-ird4yH5UA%40mail.gmail.com.

No comments:

Post a Comment