#1330 closed defect (fixed)
[magic-removal] edit_inline completely broken
| Reported by: | Owned by: | Jacob | |
|---|---|---|---|
| Component: | Core (Other) | Version: | magic-removal |
| Severity: | major | Keywords: | |
| Cc: | cmlenz@…, david.ascher@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When attempting to set a ForeignKey to edit_inline=models.TABULAR in magic-removal (r2279), I get the following error:
Exception Type: AttributeError Exception Value: 'RelatedObject' object has no attribute 'get_manipulator_fields' Exception Location: /home/korpios/devel/py3p/django/db/models/manipulators.py in __init__, line 73
It appears that RelatedObjects are built in the get_all_related_objects method of django.db.models.options.Options; these are returned when the __init__ method of django.db.models.manipulators.AutomaticManipulator calls get_all_related_objects. Subsequently in the manipulator code, however, it expects such a RelatedObject to have a get_manipulator_fields method as if it were a subclass of Field (or mimicking one in part). Attempting to simply redirect such calls to the RelatedObject's field attribute results in further failures down the line (e.g., expecting a get_list method).
Going back to trunk, it seems that RelatedObject has these methods; I'm not sure with what code the fault lies here in magic-removal (i.e., with RelatedObject or AutomaticManipulator), so I'll defer to someone with more experience in this particular area.
Attachments (1)
Change History (13)
comment:1 by , 20 years ago
| Cc: | added |
|---|
comment:2 by , 20 years ago
comment:3 by , 20 years ago
Same error in [2433] with a very basic model with one SlugField and three CharFields. Happens when I try to add an object in admin.
comment:4 by , 20 years ago
Narrowing in: I get this error in admin only when trying to add objects for models which are used as a ForeignKey in another model.
comment:5 by , 20 years ago
get_manipulator_fields() was removed from class RelatedObject in [1769].
comment:6 by , 20 years ago
Correction: this problem hits me only if I use edit_inline. Anyway, Jacob seems to have a hold of it so I'll stop babbling here.
comment:7 by , 20 years ago
| Cc: | added |
|---|
by , 20 years ago
| Attachment: | django_edit_inline.diff added |
|---|
Patch that restores edit_inline functionality to state in trunk
comment:8 by , 20 years ago
| priority: | normal → high |
|---|---|
| Severity: | normal → major |
| Summary: | [magic-removal] RelatedObject expected to have attributes of Field in manipulator code → [magic-removal] edit_inline completely broken |
I've attached a patch that fixes the edit_inline support on the magic-removal branch, so that the branch provides the same functionality as trunk. This mainly consisted of reverting a couple of changes to manipulators, formfields and the admin that were never completed. In particular, core fields and the xxx_num_in_admin options are added back. Sorry.
I suppose this is somewhat controversial. However: these changes are pretty minimal, and restore a fully-functioning (AFAICT, at least) edit_inline system. I'd very much appreciate if you guys checked this in and wrapped up the MR branch.
Other changes such as moving edit_inline to Dojo/AJAX, removing core fields, recursive manipulators and all that should have a working base to build on. Please :-P
comment:9 by , 20 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
Oh HELL yeah -- you're my hero, Christopher :)
I'm going to take a quick look at this and then roll it in. Keep in mind (for anyone who wants to hack on this) thatr the API will likely change once the validator-aware-models changes get finished, but we need this to work for the time being.
comment:10 by , 20 years ago
Cool, please let me know if you find any issues with the patch.
Forgot to add that there are a couple of lines that implement support for edit_inline for one-to-one relations.
comment:11 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
(In [2502]) magic-removal: fixed #1330: edit-inline works again on magic-removal. Note that the API will change *substantailly* before we're done (for example, this reintroduces core fields, which suck) but this at least gives us a place to start with.
Many many thanks for Christopher Lenz, my new hero.
comment:12 by , 18 years ago
| Reporter: | changed from to |
|---|
This still appears to be an issue in [2307] with
edit_inline(in my casemodels.TABULAR).