I have sat and thought about this for a while and I still have
absolutely no idea what you're asking. Could you forget about the
abstract stuff with animals and cages and show some small examples of
the code you're trying to write and an explanation of what isn't
working? Is an animal class meant to be linked to a cage class? Is a
cage even a class, or is it an attribute? Why was serializing ever an
option for relational model representation?
Unfortunately, you've over-generalised your problem to the degree that
it probably only makes sense to you now. :-)
Regards,
Malcolm
class Task(models.Model):
...
class Attempt(models.Model):
task = models.ForeignKey(Task)
content_type = models.ForeignKey(ContentType)
object_id = models.IntegerField()
test = models.GenericForeignKey()
The test / content_type / object_id collection point to your various
test classes. You can then run through them with:
for attempt in task.attempt_set.all():
attempt.test.run_test(...)
[...]
> I hope that makes it a bit clearer.
>
> Cage = Task
> Animals = Tests
> walk = run_test()
>
> I think my analogy wasn't that bad.
Whatever. When I said I couldn't understand it, I wasn't just making
idle conversation. It wasn't at all clear what were classes or models in
your original description. This time around, you talked about concrete
models and assigning something to something else using many-to-many
relations and so forth. It may well have made sense to you, but that's
the least of concerns when asking for help.
Regards,
Malcolm