django-rest-passwordreset
django-rest-passwordreset copied to clipboard
IntegrityError at /api/password_reset/ null value in column "id" of relation "django_rest_passwordreset_resetpasswordtoken" violates not-null constraint
null value in column "id" of relation "django_rest_passwordreset_resetpasswordtoken" violates not-null constraint DETAIL: Failing row contains (2022-08-18 04:56:49.334713+00, 5e47cb425ce5db35388725370cb3dbf4e964245e, 49.204.165.2, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KH..., 11, null).
Same error as above when using django==4.1 and django-rest-passwordreset == 1.2.1
Same error as above when using django==4.1 and django-rest-passwordreset == 1.2.1
Did you get a fix
Same error as above when using django==4.1 and django-rest-passwordreset == 1.2.1
Did you get a fix
yes by downgrading the version of django from 4.1 to 3. django password reset works on django < 4.0
Is there any other way I can get it to work on django 4.1
I think this happens due to changes to AutoField in Django 4.1. I was able to solve this issue simply by deleting existing migrations and regenerating them.
I see there is already a MR doing something similar here, non destructively: https://github.com/anexia-it/django-rest-passwordreset/pull/162
Good point, I will upgrade SnyPy to Django 4.1 and look deeper into this :wink:
I think this happens due to changes to AutoField in Django 4.1. I was able to solve this issue simply by deleting existing migrations and regenerating them.
I see there is already a MR doing something similar here, non destructively: #162
Have you been able to get it work on production envoirnment
I think this happens due to changes to AutoField in Django 4.1. I was able to solve this issue simply by deleting existing migrations and regenerating them. I see there is already a MR doing something similar here, non destructively: #162
Have you been able to get it work on production envoirnment
No, I have cloned the package as a Django app and rerun migrations within my project.
I can confirm that this release of Django fixes the problem for my project.
https://docs.djangoproject.com/en/4.1/releases/4.1.1/
I was not able to reproduce this on SnyPy with Django 4.1.0. Thanks @Collederas for confirming that it work with 4.1.1
The release notes also mention that some fixes where applied related to the AutoField
.
Fixed a regression in Django 4.1 that caused an incorrect migration when adding AutoField, BigAutoField, or SmallAutoField on PostgreSQL ([#33919](https://code.djangoproject.com/ticket/33919)).
Fixed a regression in Django 4.1 that caused a migration crash on PostgreSQL when altering AutoField, BigAutoField, or SmallAutoField to OneToOneField ([#33932](https://code.djangoproject.com/ticket/33932)).
I use django 4.1.1 and latest version of this package, 1.3, still getting the error
Still getting the same error with the latest version of djago and the package.
@cristianrat @shubh010 which database backend and version are you using?
@nezhar postgres 14
@cristianrat @shubh010 which database backend and version are you using?
postgres
@nezhar postgres 14
I have cloned the package as a Django app and removed id field from the model and then ran migrations again. Now it works for me.
I don't think there is the need to remove the id field, re-running migrations should work fine under Django 4.1.1. But make sure to unapply the ones generated before updating it.
I don't think there is the need to remove the id field, re-running migrations should work fine under Django 4.1.1. But make sure to unapply the ones generated before updating it.
should, but doesn't I unapplied migration for this app and re-applied it result is the same, it doesn't work
I don't think there is the need to remove the id field, re-running migrations should work fine under Django 4.1.1. But make sure to unapply the ones generated before updating it.
should, but doesn't I unapplied migration for this app and re-applied it result is the same, it doesn't work
I have removed the id field from migration and now it works fine for me.
@shubh010 really the only way?
no fix for this?
I fixed this on my db by setting auto increment (not sure if best solution, but will have to do until a real fix is implemented)
We believe that the best way forward is to create a fixture of the existing data as a backup if thats needed then make a python manage.py migrate django-rest-passwordreset zero
after that and migrate again and import the fixture.
The django fix for 4.1 explains it a bit better: https://code.djangoproject.com/ticket/33919
Updating Django to 4.1.1 also worked for me. django_rest_passwordreset==1.3 djangorestframework==3.13