revsys / django-tos

A small app to ensure your users re-agree to Terms of Service changes
BSD 3-Clause "New" or "Revised" License
153 stars 42 forks source link

NoActiveTermsOfService after resetting the DB #86

Open GFuhr opened 1 month ago

GFuhr commented 1 month ago

Hi, I'm new to django and django-tos but I had the following issue : First I started a new project, create my superuser, add my app etc and then add django-tos and it was working well, in particular I was able to log to the admin page. Then I deleted the sqlite file (so full reset of the DB, superuser included) and create again my superuser. However this time, since the migration for django-tos happened at the same time that I created to project I'm not even able to log for the 1st time to the admin page since there is no ToS configured and I have the exception : NoActiveTermsOfService at /terms-of-service/confirm/ ['Please create an active Terms-of-Service']

Regards, Guillaume

nicholasserra commented 1 month ago

Could just add a data migration to the migrations to create a TOS. Also, a patch was just added via #80 to only throw the error when DEBUG is False. That change will go out on the next version bump and should also solve the issue.

cc @frankwiles we're due for a version bump on this one, thanks!

GFuhr commented 1 month ago

I agree for the data migration it's what I did at the end through the "django shell" to create a new ToS but based on the comments in the code, is it normal that the ToS agreement is asked when I try to log on the admin page as superuser?

nicholasserra commented 1 month ago

It's a middleware so it doesn't care what url is being hit, it'll check