Skip to content
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

Can't add tags to projects #99

Open
gacheiro opened this issue Aug 31, 2020 · 2 comments
Open

Can't add tags to projects #99

gacheiro opened this issue Aug 31, 2020 · 2 comments

Comments

@gacheiro
Copy link
Member

gacheiro commented Aug 31, 2020

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 Fix #10 #38: Comment out failing migrations #104)
  • Install database fixtures by running pygameweb_fixtures command.
  • Run the app (pygameweb_front) and proceed to the login page (use the credentials [email protected] and password to login).
  • Go to the Add a new project page.
  • 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.
@illume
Copy link
Member

illume commented Sep 5, 2020

Seems to be when projects are added without an image, but with tags.
There's a PR in progress here: #100

@gacheiro
Copy link
Member Author

gacheiro commented Sep 6, 2020

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants