This is the error I am getting while creating an object in django. I know there is a mistake in defining the unicode for that particular model. But, I don't know how to define one for ManyToManyField in django.
1 Answers
1
votes
I've incurred in the same "maximum recursion depth exceeded" issue today and I realized that my IDE generated automatically this method for my Model.
def __str__(self):
return super(MyModel, self).__str__()
This is one the main reasons the maximum recursion might be raised, when a method/function triggers a loop of invocations without any control.
Perhaps this happens when the Purchases.unicode asks for the unicode from the UserProfile, which again asks for a descriprion (unicode or str, I hope, from a django relation which is basically a django Field, from django/db/models/fields )



ManyToManyfields feels like it should be aForeignKey. Either way you don't want to be puttingcurruserin the__unicode__method as that's not going to have a useful value-- it's the model manager, not a string. I think you want aForeignKeythere. - Tom