Custom ManyToManyQuery?
See f1988db for the changes.
 Thanks for the quick fix @coleifer!

That fixes the main issues, though I'd still need to overwrite and copy-paste [`ManyToManyFieldDescriptor.__get__`](https://github.com/coleifer/peewee/blob/master/playhouse/fields.py#L169) and [`ManyToManyQuery.clone`](https://github.com/coleifer/peewee/blob/master/playhouse/fields.py#L189), any idea to prevent that too?
 Replacing:

```
    def clone(self):
        query = ManyToManyQuery(
            self._instance,
            self._field_descriptor,
            self.model_class)
        query.database = self.database
        return self._clone_attributes(query)
```

by

```
    def clone(self):
        query = self.__class__(
            self._instance,
            self._field_descriptor,
            self.model_class)
        query.database = self.database
        return self._clone_attributes(query)
```

would help without hurting, imho :)
 You could probably override `clone()` in your subclass. I think that would
actually be more appropriate.

On Tue, Feb 2, 2016 at 4:48 AM, Yohan Boniface notifications@github.com
wrote:

> Replacing:
> 
> ```
> def clone(self):
>     query = ManyToManyQuery(
>         self._instance,
>         self._field_descriptor,
>         self.model_class)
>     query.database = self.database
>     return self._clone_attributes(query)
> ```
> 
> by
> 
> ```
> def clone(self):
>     query = self.__class__(
>         self._instance,
>         self._field_descriptor,
>         self.model_class)
>     query.database = self.database
>     return self._clone_attributes(query)
> ```
> 
> would help without hurting, imho :)
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/coleifer/peewee/issues/838#issuecomment-178504560.
 > You could probably override `clone()` in your subclass. I think that would actually be more appropriate.

Why is that more appropriate?
IMHO, using `self.__class__` in peewee code does not hurt and make it more generic, preventing users to override `clone` just because they have a custom ManyToManyQuery class.

I'd like to implement a custom result wrapper for my ManyToManyQuery (already done a custom [SelectQuery](https://github.com/etalab/ban/blob/master/ban/db/model.py#L6)), but currently the `ManyToManyQuery` is hardcoded in the [ManyToManyFieldDescriptor](https://github.com/coleifer/peewee/blob/master/playhouse/fields.py#L168) (and in `ManyToManyQuery.clone`), which itself is hardcoded in [ManyToManyField](https://github.com/coleifer/peewee/blob/master/playhouse/fields.py#L116).

Would you consider a PR that would make that more customizable? I'm thinking about making those class attributes. Something like this:

``` python
# Or maybe better at Field level directly?
class ManyToManyField(Field):
    descriptor_class = ManyToManyFieldDescriptor

    def add_to_class(self, model_class, name):
        …
        setattr(model_class, name, self.descriptor_class(self))
        …

class ManyToManyFieldDescriptor(FieldDescriptor):
    query_class = ManyToManyQuery
    …
```

Thoughts?
