Compare commits

..

No commits in common. "03dc6f98c8cb8eb3879914366eca89a23b9a644a" and "748ad7eb4813f2bb2f273a5e29cadeda1d58c3a1" have entirely different histories.

4 changed files with 8 additions and 32 deletions

View File

@ -1,21 +0,0 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.core.management.base import BaseCommand
from django.db import connection
class Command(BaseCommand):
"""
Command to protect sensitive data during the beta phase, to prevent a right escalation.
Phone number, email address, postal address, first and last name are removed.
"""
def handle(self, *args, **kwargs):
cur = connection.cursor()
cur.execute("UPDATE member_profile SET "
"phone_number = '0123456789', "
"address = '4 avenue des Sciences, 91190 GIF-SUR-YVETTE';")
cur.execute("UPDATE auth_user SET "
"first_name = 'Anne', "
"last_name = 'Onyme';")
cur.close()

View File

@ -295,7 +295,7 @@ class Command(ImportCommand):
remittance_dict = {
"pk": pk_remittance,
"date": make_aware(row["date"][:19]),
"date": make_aware(row["date"]),
"remittance_type_id": 1, # Only Bank checks are supported in NK15
"comment": row["commentaire"],
"closed": row["close"],
@ -315,9 +315,6 @@ class Command(ImportCommand):
for idx, row in enumerate(cur):
self.update_line(idx, n, row["nom"])
if not row["idremise"]:
continue
tr = SpecialTransactionProxy.objects.get(transaction__id=MAP_TRANSACTION[row["idtransaction"]])
tr.remittance_id = MAP_REMITTANCE[row["idremise"]]
tr.save()

View File

@ -14,6 +14,10 @@ class Command(BaseCommand):
"""
Command to add the ten most used buttons of the past month to the highlighted buttons.
"""
def add_arguments(self, parser):
return parser
def handle(self, *args, **kwargs):
queryset = RecurrentTransaction.objects.filter(
template__display=True,

View File

@ -33,14 +33,10 @@ class Command(BaseCommand):
# no app specified, sync everything
model_classes = apps.get_models(include_auto_created=True)
db_names = [
m._meta.db_table for m in model_classes
if m.__base__.__base__ is not PolymorphicModel and m.__name__ not in NO_SEQ and m.objects.count() > 1
]
db_names = [ m._meta.db_table for m in model_classes if m.__base__.__base__ is not PolymorphicModel and m.__name__ not in NO_SEQ and m.objects.count()>1]
com = "BEGIN;\n"
for db_name in db_names:
com += f'SELECT setval(pg_get_serial_sequence(\'"{db_name}"\',\'id\'), coalesce(max("id"), 1),' \
f' max("id") IS NOT null) FROM "{db_name}";\n'
com += f'SELECT setval(pg_get_serial_sequence(\'"{db_name}"\',\'id\'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "{db_name}";\n'
com += "COMMIT;"
print(com)
cur = connection.cursor()