coddingtonbear/django-measurement

RuntimeError: maximum recursion depth exceeded

Closed this issue · 10 comments

Hi I encountered the following error. Seems you have a little loop in there.

  File "django_measurement/admin.py", line 88, in get_fieldsets
    form = self.get_form(request, obj)(instance=obj)
  File "django/contrib/admin/options.py", line 503, in get_form
    fields = flatten_fieldsets(self.get_fieldsets(request, obj))

BTW: We're talking Python 2.7 and Django 1.6.1 here.

I haven't really looked deep enough into the code yet to fix it myself, plus there isn't a doc-string to tell me what the method should be doing.

Thanks for reporting this! Interestingly -- I've actually been running this on Django 1.6.1/Python 2.7 since 1.6.1's release myself without bumping into this yet. Could you perhaps provide me with a little more information about how you're using this (or, if you're very motivated, a test case) so I might have a reliable way of reproducing this?

Cheers,
Adam

Actually -- scratch that, I just reproduced this problem :-|.

Again, thanks for reporting this -- I'll have a look this afternoon.

Although I did work around the surface issue reproduced above, there is a greater underlying issue for which a workaround isn't clear to me quite yet.

The root of the problem is that I'm dynamically adding fields to the model form to allow you to edit the measurement field, but Django >= 1.6 checks to see which fields are available in a way that breaks this.

In the meantime, I've posted 5d24e29 which circumvents the problem by neutering django-measurements when one is using Django >= 1.6.

I'm still looking, but it may be a few days before I find the time to get this working properly.

Hi folks, just wondering, is this still usable with Django 1.6+ if one does not use the admin interface at all? (It looks like it is triggered by using MeasurementAdmin, but if I want to just use the fields in my own models and forms, will it still work? I'm just trying to understand the impact.)

Yep-- as far as I know, this is OK to use even in Django 1.6 now, but the measurement admin forms are disabled.

Do let me know if you encounter a problem, though.

On Mar 2, 2014, at 13:03, Kevin Partington notifications@github.com wrote:

Hi folks, just wondering, is this still usable with Django 1.6+ if one does not use the admin interface at all? (It looks like it is triggered by using MeasurementAdmin, but if I want to just use the fields in my own models and forms, will it still work? I'm just trying to understand the impact.)


Reply to this email directly or view it on GitHub.

I hope to get on it soon. I need to fix this for a big project anyway, it's currently waiting in our backlog.

@coddingtonbear I hope you to fix this problem soon, I would love if you get some time to do that

Any updates on this? Theres a 1.7 pull request, but it seems to silently drop the requested unit which sort of breaks things a little bit.

Fixed in 6e670a4