Opened 10 years ago

Closed 7 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


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 10 years ago. (727 bytes) - added by Andy MacKinlay 9 years ago. which has a minimal doctest to reproduce the problem

Download all attachments as: .zip

Change History (11)

Changed 10 years ago by Andy MacKinlay

comment:1 Changed 10 years ago by Andy MacKinlay

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 Changed 10 years ago by Marc Fargas

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.

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

Changed 9 years ago by Andy MacKinlay which has a minimal doctest to reproduce the problem

comment:3 Changed 9 years ago by Andy MacKinlay

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 shows the desired behaviour - running test on the app will fail as it throws a DoesNotExist error.

comment:4 Changed 8 years ago by mtarbit

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

comment:5 Changed 7 years ago by slewis

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

comment:6 Changed 7 years ago by Luke Plant

Severity: Normal
Type: Bug

comment:7 Changed 7 years ago by Julien Phalip

Easy pickings: unset
Needs tests: set

comment:8 Changed 7 years ago by oz

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 Changed 7 years ago by Preston Holmes

Resolution: wontfix
Status: newclosed
UI/UX: unset

Databrowse is now deprecated, see #16907

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