Unable to reach foreign key when doing an 'join on' with table
Try adding `UserOrder.link_to_id` to the select clause:

``` python
(ExtensionData.
 select(
    ExtensionData, UserOrder.avg_user, UserOrder.link_to_id)
 .join(UserOrder, on=(ExtensionData.id == UserOrder.link_to_id))
 .order_by(UserOrder.avg_user.desc()))
```

If that doesn't work, could you share a minimal set of model code so that I can attempt to reproduce the issue?
 Nope, your suggested solution did not work. I've shared my model code below. UserOrder is a view. 

```
class BaseModel(Model):
    class Meta:
        database = db

class ExtensionData(BaseModel):
    name = CharField()
    link = CharField(unique=True) 
    hp = CharField(null=True)
    email = CharField(null=True)
    category = CharField(null=True)
    browser = CharField()
    updated = DateField(default=datetime.date.today())

class DailyData(BaseModel):
    date_scraped = DateField(default=datetime.date.today())
    link_to = ForeignKeyField(ExtensionData, related_name='data_entries')
    nr_users = IntegerField()
    nr_reviews = IntegerField()
    downloads = IntegerField(null=True)
    rating = DecimalField()

class UserOrder(BaseModel):
    link_to_id = PrimaryKeyField()
    avg_user = FloatField()

    class Meta:
        db_table = 'user_order'
```
 The issue is that the `id` field is getting overwritten by the related `UserOrder`. To fix this:

``` python
(ExtensionData.
 select(
    ExtensionData, UserOrder.avg_user, UserOrder.link_to_id)
 .join(
     UserOrder, 
     on=(ExtensionData.id == UserOrder.link_to_id).alias('user_order'))
 .order_by(UserOrder.avg_user.desc()))
```
 Great, thank you. I'm thinking of writing something about this in the documentation, it would be nice to include something about referring views as well as I couldn't find that in the documentation either when I was looking. Perhaps under Peewee cookbook section?
 Sounds good, feel free to submit a pull-request.

So when I join the ExtensionData and UserOrder together I'm unable to access the foreign key relationship (data_entries) with DailyData. It seems as if it doesn't get the primary key from ExtensionData because of [None] at the end of the SQL query. This does not happen when you the ExtensionData by itself. 

```
output = ExtensionData.select(ExtensionData, UserOrder.avg_user).join(
        UserOrder, on=(ExtensionData.id == UserOrder.link_to_id)
        ).order_by(UserOrder.avg_user.desc())
entry = output[0]
entry.data_entries > 
<class 'models.DailyData'> SELECT t1."id", t1."date_scraped", t1."link_to_id", t1."nr_users", t1."nr_reviews", t1."downloads", t1."rating" FROM "dailydata" AS t1 WHERE (t1."link_to_id" = %s) [None]
entry.id >
<models.UserOrder object at 0x1593490> # id has been replaced by this
```
