Opened 17 years ago

Closed 13 years ago

#7135 closed Bug (wontfix)

Databrowse doesn't handle model inheritance

Reported by: Andy MacKinlay Owned by: nobody
Component: contrib.databrowse Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Databrowse currently doesn't support model inheritance. This is related to not supporting one-to-one fields, for which there is already a patch over at #6913. This patch enacts the same changes (in a slightly different way) as the other ticket but also checks to see whether accessing the one-to-one field (eg from a subclass) throws a DoesNotExist exception (in which case the instance isn't linked to a corresponding subclass of that type) and doesn't list it as a related field in that case.

Attachments (2)

databrowse-fix-for-inheritance.diff (1.5 KB ) - added by Andy MacKinlay 17 years ago.
models-with-test-for-databrowse-and-inheritance.py (727 bytes ) - added by Andy MacKinlay 16 years ago.
models.py which has a minimal doctest to reproduce the problem

Download all attachments as: .zip

Change History (11)

by Andy MacKinlay, 17 years ago

comment:1 by Andy MacKinlay, 17 years ago

I should note that at least in my dev setup, this still doesn't produce exactly the correct behaviour (it produces links to subclass instances which don't actually exist, and then these of course produce errors), but this is due to a bug in model inheritance which I will post a new ticket on shortly when I've worked out the exact circumstances under which it occurs.

comment:2 by Marc Fargas, 17 years ago

Triage Stage: UnreviewedAccepted

#6913 was closed in favour if this one as the patch here provides more functionality.
The next time, *please* don't open a new ticket, attach your patch to the other ticket and add a comment.
Thanks.

Not sure if this needs tests tought. Could you add it?

by Andy MacKinlay, 16 years ago

models.py which has a minimal doctest to reproduce the problem

comment:3 by Andy MacKinlay, 16 years ago

Version: SVN1.0

Ok, just confirmed the problem still exists in 1.0, and the patch still works.

After some fiddling I managed to get a fairly minimal test case which I've attached. The doctest in the models.py shows the desired behaviour - running manage.py test on the app will fail as it throws a DoesNotExist error.

comment:4 by mtarbit, 15 years ago

This is still an issue, and the fix still works. Any particular reason why the ticket has gone quiet?

comment:5 by slewis, 14 years ago

Seconding the above question. OneToOneFields break databrowse. Why not accept the patch?

comment:6 by Luke Plant, 14 years ago

Severity: Normal
Type: Bug

comment:7 by Julien Phalip, 14 years ago

Easy pickings: unset
Needs tests: set

comment:8 by oz, 14 years ago

databrowse has been broken for 3 years and no-one seems to mind. OneToOne fields don't work, nor do nullalbe ForeignKeys (ticket #15792).
Both have patches that solve the problem, yet are still open for a long long time. It's a shame since it renders databrowse (which is potentially awesome) useless for many projects.

comment:9 by Preston Holmes, 13 years ago

Resolution: wontfix
Status: newclosed
UI/UX: unset

Databrowse is now deprecated, see #16907

Note: See TracTickets for help on using tickets.
Back to Top