I must tip my hat to the Django crew. The smartness of their Model code has wowed me from the first moment I tried out their framework.
I've got foreign keys working now. But they're not as fancy as with Django. You can't filter Entries with them, because the Entries object sees only the id numbers. And this is what's got me right now pondering about how to implement many-to-many relationships. Getting the integer value of the foreign key makes little value, as the search should 'see over to the other side' and 'through the join table'. I could simply not do them, and have the user do a model with two foreign keys. But that, again, is against my design mantra.
What really got me wondering with the Django implementation is that only one of the two models involved need a ManyToManyField, referencing to the other model. The other model that's referenced, but doesn't include a ManyToManyField still can access that join table, even if it's not mentioned anywhere. Without rummaging around their code, I'm thinking that either they have done something very clever, or then they do a lot of 'unnecessary' SQL queries, and I'm thinking it's the former.
Oh well. I think I've got some ideas up my sleeve. I'll see what I can do.
PS: I've put off doing the i18n for Fields. I'm sure it can be retrofitted transparently without any need of changes to user code. Getting the basics working is paramount at this moment. I might actually postpone the i18n even further to the future. I want the test version done and over with, so I could finally get some feedback.
Sunday, March 9, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment