forked from rdmorganiser/rdmo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-1.10.0' into 'feature/490-editor-permissions-multis…
…ite' Fixes base branch 490-editor-permissions-multisite See pull request rdmorganiser#565
- Loading branch information
Showing
40 changed files
with
477 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import sys | ||
import csv | ||
|
||
from datetime import datetime | ||
|
||
import pytz | ||
|
||
from django.contrib.auth.models import User | ||
from django.core.management.base import BaseCommand | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
columns = ('id', 'username', 'first_name', 'last_name', 'email', 'date_joined', 'last_login') | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('since', | ||
type=lambda s: pytz.utc.localize(datetime.strptime(s, '%Y-%m-%d')), | ||
help='Date since the users have been inactive (format: "2022-12-31").') | ||
parser.add_argument('-o|--output-file', dest='output_file', default=None, | ||
help='Store the output in a csv file.') | ||
|
||
def handle(self, *args, **options): | ||
rows = User.objects.filter(last_login__lt=options['since']) \ | ||
.order_by('-last_login').values_list(*self.columns) | ||
|
||
if rows: | ||
fp = open(options['output_file'], 'w') if options['output_file'] else sys.stdout | ||
csv_writer = csv.writer(fp) | ||
csv_writer.writerow(self.columns) | ||
csv_writer.writerows(rows) | ||
fp.close() |
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 |
---|---|---|
|
@@ -138,6 +138,7 @@ class Meta: | |
fields = ( | ||
'id', | ||
'uri', | ||
'uri_prefix', | ||
'key', | ||
'path', | ||
'read_only' | ||
|
Binary file not shown.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.