How to move user to another group after n-days?

Hello, can you please tell is there any built-in mechanism which will automatically transfer the user to another group after a specified period of time? The task in fact is to implement different types of accounts (free and paid), and accordingly, the expiration of a paid account, the user needs to get into the group to free.

I see two decisions on the forehead:
1. To run the script, for example once a day, which go through the accounts and see not over whether a paid account.
2. To update the information directly in the user's authorization on the website.

The first option I don't like on a second more to think. But perhaps there is a "right" decision?
July 12th 19 at 16:54
3 answers
July 12th 19 at 16:56
The second version of the rules, you still check that they are logged in on each page, add a check for expiration of deysvtiya and fundamental difference between these checks I do not see.
extra query to the database will not? - Mortimer32 commented on July 12th 19 at 16:59
: well, it depends on where your time, put it in user, will not, in any profile - it will be if it is not in use for anything, anyway and then, and it is possible to cache - Noemy_Prosac commented on July 12th 19 at 17:02
July 12th 19 at 16:58
The canonical way to do this in Django - add a django-admin command, and periodically run this command using cron:
Writing custom django-admin commands
July 12th 19 at 17:00
Embedded solutions for solving such problems at Jangi no.
Why don't you like the first option? It is possible, using celery, for example, to create a periodic task and propagates times a day by user accounts.

Find more questions by tags PythonDjango