-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Let's say somehow I get an (unsaved) Animal instance. There isn't a pretty way to recast as a Canine or Feline:
animal = Animal('phoebo')
# This is a no-op thanks to https://github.com/craigds/django-typed-models/blob/master/typedmodels/models.py#L329
animal.recast(Feline)
# This doesn't work either (unless your model defines __str__ to be <app_name>.<model_name>)
animal.type = Feline
# These will work, but isn't ideal
animal.type = 'my_app.Feline'
animal.recast()
# This works too (but only by coincidence, by how recast is implemented)
animal.type = 'nonesense'
animal.recast(Feline)
IMO animal.recast(Feline) should be supported.
(setting the type is smelly, since type is supposed to be a string field)
Metadata
Metadata
Assignees
Labels
No labels