-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
name 'Serial' is not defined #865
Comments
Serial is not added to extra_imports when rendering the template. Or is it related to |
Ah, interesting - is this on the most recent version of Piccolo? I wonder under what situations it happens? Were you adding a foreign key to an existing table, or was this a new table? |
I had this problem with one previous version of Piccolo, and now I'm on the latest version. When I added a foreign key to my forwarded(migrated) User and Tariff tables for Order table.
It worked for all apps without problems. But when I use the
|
Yeah, I think I saw this on a previous version of Piccolo. The fix is to manually add the import to the migration file:
I need to try and figure out if it's a still a problem (i.e. if you create a new migration does it have this problem, or is it just for migrations created in older versions). So far I've tried adding a foreign key to an existing table, and that included the |
Yes, I was doing this solution until now. But I thought this issue was a bug because it appeared in my 2-3 projects where different versions of Piccolo were used.
So, do I need to migrate my foreign tables first and then add the foreign key? So sorted apps now can't be a help/solution either? |
I had an empty db and empty piccolo_migrations folder (per app) in this try.
|
@dantownsend The problem is with LazyTableReference and was solved when I removed it and imported the model from my other app/tables.py in the tables.py file. |
@hoosnick Ah, that's good to know. I was trying to find the commit where I thought I'd fixed the |
I came across this bug today - you're right, it's caused when creating a migration with a |
@dantownsend Has the bug been fixed? |
@hoosnick Not yet - I've had a look into it, but haven't created a PR yet. |
When creating a new migration, I think this bug(error) only occurs with ForeignKeys, details below:
Traceback
The text was updated successfully, but these errors were encountered: