How to store a reference to model type in another model instance
So this is a little exercise in the meta meta.. I want to be able to store model reference as a row in a table associated with another model. Something like this:
class Widget(models.Model): related = models.Model() # data model associated with this widget identifier = models.CharField(max_length=500) # human-friendly descriptor
This doesn't validate.. I've found an acceptable workaround, but I'm wondering if there's a more proper/graceful way of doing this.
Thanks, django wizards!
If I understand your question correctly then GenericForeignKey is what you need. Have you looked at it?