Skip to content

use generic foreign keys for votes instead of multi-table inheritance? #43

@zackmdavis

Description

@zackmdavis

When I showed the Vote, PostVote, and CommentVote models to some of my colleagues (as part of a discussion about the viability of model inheritance in Django), there was some criticism of the extra join involved in our current approach, and generic foreign keys (which I recall briefly considering at the start of the project before shying away because Django's way of doing that looked complicated) was suggested as a superior alternative. What if we switch to do it that way (that is, our models would look mostly the same except that Vote would have a Meta class with abstract = True, and CommentVote and PostVote would have the appropriate GenericForeignKeys instead of ForeignKeys) by means of writing a terrifyingly complicated but super-educational grand schema/data migration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions