Skip to content

OneToOneField cannot be primary key #53

@macropin

Description

@macropin

This example

class Account(PolymorphicModel):
    user = models.OneToOneField(User, primary_key=True)

fails with Caught AttributeError while rendering: type object 'Account' has no attribute 'polymorphic_primary_key_name'

2c47db8 introduced a new way of determining pk's which specifically excludes OneToOneField fields: if f.primary_key and type(f)!=models.OneToOneField:

This issue was reported downstream 2 years ago at bconstantin#17.

Why exclude OneToOneField's? The tests continue to pass after removing this restriction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions