Can't add tags to projects
When I try to add one or more tags to a project, I get:
sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "id" violates not-null constraint
DETAIL: Failing row contains (2, puzzle, null).
[SQL: INSERT INTO tags (project_id, value) VALUES (%(project_id)s, %(value)s) RETURNING tags.id]
[parameters: {'project_id': 2, 'value': 'puzzle'}]
(Background on this error at: http://sqlalche.me/e/13/gkpj)
This seems to be raised by the following code, in pygameweb.project.views line 326:
...
tag = Tags(project=project, value=value)
current_session.add(tag)
...
current_session.commit()
Postgres should autogenerate the id, but it doesn't. The above code passes in tests, so it might be a problem with the migrations.
Edit: Steps to reproduce
- Install the pygame website as discribed in the Quickstart section of README.
- Make sure you run database migrations
alembic upgrade head(If you have problems running migrations please check #104) - Install database fixtures by running
pygameweb_fixturescommand. - Run the app (
pygameweb_front) and proceed to the login page (use the credentials[email protected]andpasswordto login). - Go to the
Add a new projectpage. - Fill up new project form with some sample data. Make sure you add at least one tag e.g.
2d. No need to add an image. - Submit the form. Now you should be presented with the error message described above.
Seems to be when projects are added without an image, but with tags. There's a PR in progress here: https://github.com/pygame/pygameweb/pull/100
@illume, seems to me that this is not the case, as the test added in #100 doesn't fail. Unless I forgot something?
I made some test locally and I still get the same error with and without providing an image. Just added steps to reproduce section, so hopefully someone can try to reproduce it?