-
-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
153 changed files
with
19,526 additions
and
3,669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,6 @@ omit = | |
*/tests.py | ||
*/test.py | ||
checks/utils.py | ||
*/asgi.py | ||
*/demo_views.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# import datetime as dt | ||
import random | ||
|
||
from django.core.management.base import BaseCommand | ||
from django.utils import timezone as djangotime | ||
from agents.models import Agent | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "stuff for demo site in cron" | ||
|
||
def handle(self, *args, **kwargs): | ||
|
||
random_dates = [] | ||
now = djangotime.now() | ||
|
||
for _ in range(20): | ||
rand = now - djangotime.timedelta(minutes=random.randint(1, 2)) | ||
random_dates.append(rand) | ||
|
||
for _ in range(5): | ||
rand = now - djangotime.timedelta(minutes=random.randint(10, 20)) | ||
random_dates.append(rand) | ||
|
||
""" for _ in range(5): | ||
rand = djangotime.now() - djangotime.timedelta(hours=random.randint(1, 10)) | ||
random_dates.append(rand) | ||
for _ in range(5): | ||
rand = djangotime.now() - djangotime.timedelta(days=random.randint(40, 90)) | ||
random_dates.append(rand) """ | ||
|
||
agents = Agent.objects.only("last_seen") | ||
for agent in agents: | ||
agent.last_seen = random.choice(random_dates) | ||
agent.save(update_fields=["last_seen"]) |
Oops, something went wrong.