Hi,
Is it possible to have a custom model field class inheriting from
ManyToManyField ?
I'd like to do something like this:
class CategoryLinkField(models.ManyToManyField):
def __init__(self, *args, **kwargs):
super(models.ManyToManyField, self).__init__(Category, *args,
**kwargs)
self.roots = kwargs.get('roots')
I just want the field instances always to link to the same table, and
add some attributes I need (here 'roots').
Right now, whenever I try to use that field I get the following error:
if self.rel.symmetrical and self.rel.to == "self" and
self.rel.related_name is None:
AttributeError: 'NoneType' object has no attribute 'symmetrical'
So I guess I'm on the wrong track but any help will be much
appreciated
Thanks,
Beru
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---