Hello,
I wrote a model which is not abstract, and from which a few
specialized classes derive:
| class Action( Model ):
| item = ForeignKey( Item )
| # A few other properties
|
| class Move( Action ):
| class Meta:
| proxy = True
|
| class Pick( Action )
| class Meta:
|
Thanks for this insight. I was using OneToOneField in the same way as
ForeignKey.
| class Person( Model ):
| pass
|
| class Pet( Model ):
| owner = ForeignKey( Person )
|
| # Assuming "joe" exists as a Person
| >>> kitty = joe.pet_set.get_or_create()
Yes, in that situation "joe.pet_set"
Hello Django users,
Is there a particular reason why using a related OneToOneField raises
DoesNotExist instead of returning None?
| class Person( Model ):
|pass
|
| class Pet( Model ):
|owner = OneToOneField( Person )
|
| # Assuming "joe" exists as a Person
| >>> kitty = joe.pet
|
3 matches
Mail list logo