safwanrahman / django-webpush

Web Push Notification Package for Django
GNU General Public License v3.0
362 stars 103 forks source link

Fix to creating new subscription #130

Closed jialutu closed 9 months ago

jialutu commented 9 months ago

Currently, there is an issue creating new subscription if the user_agent is not specified in the post data. The issue is that the model does not state user_agent is nullable.

To prevent creating another migration file, I've defaulted the user_agent value to blank and added in the model file to allow user_agent to be blank.

safwanrahman commented 9 months ago

LGTM. r+

chrkr commented 1 month ago

This merge causes the library to be out of sync with its migration files. This means that if you add this library to a project and run makemigrations it creates a 0006 migration file in the library's install path, which is of course highly undesirable for a lot of reasons, and does not work at all in some cases.

To fix it, the changes to the model should also be applied to the 0003 migration file, to bring it back into sync. The changes are SQL no-ops anyway, so it will not affect existing operational databases.