Skip to content

Can't register custom categories in many-to-many relation #62

dhdaines opened this Issue Jan 21, 2013 · 1 comment

2 participants


The register_m2m() function is hard coded to use the Category class.

Is there any other way to do this?

callowayproject member
coordt commented Jan 21, 2013

Yes, I think so.

You need to create your own ManyToManyField, just I like you'll see in

class CategoryM2MField(ManyToManyField):
    def __init__(self, **kwargs):
        if 'to' in kwargs:
        super(CategoryM2MField, self).__init__(to=Category, **kwargs)

Where it says to=Category, put in your own class.

Then you can call _register() function with that field as as a parameter. The parameters are _register(model, field_name, extra_params={}, field=fields.CategoryFKField)

Will this work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.