So, I've had a good look over the (constantly-growing!) code here, and
I'm really beginning to like the decorator approach, especially the nice
way you combine dependencies with the dependency classes, which makes my
solution to old/new FK values look terrible.

I still have two issues, although I'm pretty sure both can be fixed.

One: This is the MirrorField equivalent in the example:

    @denormalized(models.CharField,max_length=100)
    @depend_on_related(User)
    def owner_username(self):
        return self.owner.username

While it's really obvious what it's doing, I (for obvious reasons) would
like to have common use cases like that shortened, and the number of
things I have to type reduced (I only need one of the other model or the
foreign key attribute name, and here I need both). I've tried writing a
wrapper for MirrorField, but I'm running into the same issue I had
(which is that you have to do it on the class_prepared signal). I'll
probably have it working soon, though.

The second thing is that it doesn't play nice with South, but that's
almost certainly my fault, and nothing to do with you. If we hadn't
started scanning source code for the field definitions and ripping them
out it might have been fine, but it's proved to be the only real way...

Basically, I'm moaning as it doesn't work with my peculiar setup :)
Still, 'tis nice overall. I have a partially-complete unit test suite
for my denorm code I'd be happy to port over (it has the wonderful set
of tricks you need to unit test with a whole fake app, while still
keeping database settings) if you want.

Andrew



Christian Schilling wrote:
> i spend some time implementing my idea above (still just a proof of
> concept, all testing i did was on the example project)
> the resulting models.py: (still in the same place)
> http://github.com/initcrash/django-denorm/tree/master/example%2Fgallery%2Fmodels.py
>
> as you can see, this makes the @denormalized decorator a drop-in
> replacement for pythons @property
> decorator. and the function becomes much shorter and easier to
> understand.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to