Hello Anssi,

thanks! Seems to work. I tried it like this:

from django.db import models

class MyModelBase(models.base.ModelBase):
    def __new__(cls, name, bases, attrs):
        attr_meta = attrs.pop('Meta', None)

        try:
            has_cpk= attr_meta.has_composite_primary_key
            del attr_meta.has_composite_primary_key
        except AttributeError:
            has_cpk = False

        model = super(MyModelBase,cls).__new__(cls, name, bases, attrs)
        model._meta.has_composite_primary_key = has_cpk
        return model

And I then assigned this as the __metaclass__ to my Model class.

However I droped the whole composite forreign key idea in favor of
another solution.

So: Problem solved!

Thanks!
 Roman

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

Reply via email to