Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields on some but not all subclasses #19

Closed
andybak opened this issue Jun 21, 2014 · 2 comments
Closed

Fields on some but not all subclasses #19

andybak opened this issue Jun 21, 2014 · 2 comments

Comments

@andybak
Copy link

andybak commented Jun 21, 2014

I was hoping this was possible:

class Animal(TypedModel):
    name = models.CharField(max_length=100)

class Cat(Animal):
    meow_volume = models.IntegerField()
    owner_name = models.CharField(max_length=100)

class Dog(Animal):
    bark_volume = models.IntegerField()
    owner_name = models.CharField(max_length=100)

class Bear(Animal):
    growl_volume = models.IntegerField()

But I get:

django.db.utils.ProgrammingError: column "owner_name" specified more than once

I know I could move 'owner_name' on to the base class but then Bears have an owner - which they shouldn't have.

Is there any way that the duplicate fields could be magically recognised and de-dupped? Obviously they would have to be identical - that would be a reasonable constraint to impose on this kind of arrangement.

@saltysealion
Copy link

Any news on this? I am having the same issue.

@craigds
Copy link
Owner

craigds commented Feb 27, 2018

I think I probably missed this at the time. It actually looks like a dupe of #8, so I'll close this and update there

@craigds craigds closed this as completed Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants