What is the difference between backref and related_name and some other peewee convetions?
`backref` is the correct way -- `related_name` was used prior to Peewee 3.0 and is deprecated, but they have the same effect.

You are running into a circular import problem. Consider re-architecting your modules or become more familiar with how python imports work.

Peewee follows the convention of using `id = AutoField()` (which is an auto-incrementing integer primary key). If no primary key is specified explicitly by the user, then the model will automatically have this `id` field.

```python
class Todo(Model):
    task_name = TextField()

class TodoItem(Model):
    todo = ForeignKeyField(Todo, backref='items')
    item_name = TextField()
```

You can also explicitly specify the column the foreign-key references by specifying "field=...". The following is equivalent to the above.

```python
class TodoItem(Model):
    todo = ForeignKeyField(Todo, field='id', backref='items')
    ...
``` Thanks @coleifer! I would reread the version of the documentation I am using.  I think I did not see most of what you just have said about ForeignKeyField parameters and column/field name convention in the documentation. Anyways, thanks for the clarification.
Hi, I am trying out for the first time peewee + flask and python. For starter, I am trying to create a simple Todo app.I have some question regarding how peewee handles foreign key relations. My background is PHP and I have some experience using Eloquent. 

First, I am quite confused as to what to use when setting the attribute of the parent model from the child model when defining `ForeignKeyField`. I have seen examples using `backref `and others using `related_name`, are they the same?

Secondly, I have stored each of my model in a separate python file under the `application.models` package. For example, my `Base` model is stored in `base.py`, the `User` model in `user.py` and so on. Now I have a `ToDo` model with a foreign key from the `User` model. I defined a foreign key called `owner` and a `backref` called `todos`. Now given a `User` object `user`, I want to list all the to do of  `user` so I passed `user.todos` to my view. My Flask app is defined in a separate `app.py` file, so naturally I will import the `User` class. However, as it turns out, calling `user.todos` will result to an exception if the `Todo` model is not imported too. I find this behavior a little unusual. I am thinking maybe this is due to how python handles import. Am I right?

Lastly, I want to know what are the conventions peewee expects from the table structure. All my tables have `id` as the `primary key`, which is something Eloquent expects from a table by default. I found out that this is not the case for peewee so I need to define the field name and its related field name in a `ForeignKeyField`. 