joining on two FKs to the same table doesn't work
You need to use a model alias. See the [querying docs -- using model aliases](http://docs.peewee-orm.com/en/latest/peewee/querying.html?highlight=modelalias#using-model-aliases)

``` python
Author = Person.alias()
Editor = Person.alias()
query = (Post
         .select(Post, Author, Editor)
         .join(Author, on=(Post.author == Author.id))
         .switch(Post)
         .join(Editor, on=(Post.editor == Editor.id)))
```
 ok, that second version works, but there is still a bug here.  an ORM api should not generate obviously invalid SQL.
 > but there is still a bug here

In your opinion there is, in my opinion this is documented behavior. If you want to use a model and have it aliased to multiple aliases, you need to call `Model.alias()`.
 ```
Post.select(Post) \
   .join(Person, on=Post.author).switch(Post) \
   .join(Person, on=Post.editor)
```

gens non-nonsensical SQL.  how is non-nonsensical SQL not a bug?  there is no possible use case for having your lib generate duplicate table aliases.

gens bad SQL:

``` python
import logging, os
import peewee as pw

logger = logging.getLogger('peewee')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

db_fn = 'example.db'
if os.path.exists(db_fn): os.remove(db_fn)
db = pw.SqliteDatabase(db_fn)

class Person(pw.Model):
  name = pw.CharField()
  class Meta:
    database = db

class Post(pw.Model):
  title = pw.CharField()
  author = pw.ForeignKeyField(db_column='author_id', rel_model=Person, to_field='id')
  editor = pw.ForeignKeyField(db_column='editor_id', rel_model=Person, to_field='id', related_name='edited_posts', null=True)
  class Meta:
    database = db

db.connect()
db.create_tables([Person, Post])

alice = Person.create(name='Alice')
bob = Person.create(name='Bob')
post = Post.create(title='My Post', author=alice, editor=bob)

for post in Post.select(Post).join(Person, on=Post.author).switch(Post).join(Person, on=Post.editor):
  print post #, post.author, post.editor
```

gens:

```
$ python test2.py 
[...]
('INSERT INTO "person" ("name") VALUES (?)', [u'Alice'])
('INSERT INTO "person" ("name") VALUES (?)', [u'Bob'])
('INSERT INTO "post" ("title", "author_id", "editor_id") VALUES (?, ?, ?)', [u'My Post', 1, 2])
('SELECT "t1"."id", "t1"."title", "t1"."author_id", "t1"."editor_id" FROM "post" AS t1 INNER JOIN "person" AS t2 ON ("t1"."author_id" = "t2"."id") INNER JOIN "person" AS t2 ON ("t1"."editor_id" = "t2"."id")', [])
```

notice the join conditions are right but the table aliases conflict.

i have a potential fix but i wanted an opinion if i'm using the API wrong somehow.

this is with the latest release:

```
$ git status
HEAD detached at 7670c9e
```
