mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 14:32:19 +01:00 
			
		
		
		
	Fix date import of old documents
This commit is contained in:
		@@ -7,10 +7,10 @@ from tournament.models import Team, Tournament
 | 
			
		||||
 | 
			
		||||
class Command(BaseCommand):
 | 
			
		||||
    def add_arguments(self, parser):
 | 
			
		||||
        parser.add_argument('--tournaments', '-t', action="store_true", help="Import tournaments")
 | 
			
		||||
        parser.add_argument('--teams', '-T', action="store_true", help="Import teams")
 | 
			
		||||
        parser.add_argument('--users', '-u', action="store_true", help="Import users")
 | 
			
		||||
        parser.add_argument('--documents', '-d', action="store_true", help="Import all documents")
 | 
			
		||||
        parser.add_argument('--tournaments', '-t', action="store", help="Import tournaments")
 | 
			
		||||
        parser.add_argument('--teams', '-T', action="store", help="Import teams")
 | 
			
		||||
        parser.add_argument('--users', '-u', action="store", help="Import users")
 | 
			
		||||
        parser.add_argument('--documents', '-d', action="store", help="Import all documents")
 | 
			
		||||
 | 
			
		||||
    def handle(self, *args, **options):
 | 
			
		||||
        if "tournaments" in options:
 | 
			
		||||
@@ -202,6 +202,9 @@ class Command(BaseCommand):
 | 
			
		||||
                args = [arg if arg and arg != "NULL" else None for arg in args]
 | 
			
		||||
 | 
			
		||||
                if Document.objects.filter(file=args[0]).exists():
 | 
			
		||||
                    doc = Document.objects.get(file=args[0])
 | 
			
		||||
                    doc.uploaded_at = args[5].replace(" ", "T")
 | 
			
		||||
                    doc.save()
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
                obj_dict = {
 | 
			
		||||
@@ -236,6 +239,9 @@ class Command(BaseCommand):
 | 
			
		||||
                args = [arg if arg and arg != "NULL" else None for arg in args]
 | 
			
		||||
 | 
			
		||||
                if Document.objects.filter(file=args[0]).exists():
 | 
			
		||||
                    doc = Document.objects.get(file=args[0])
 | 
			
		||||
                    doc.uploaded_at = args[4].replace(" ", "T")
 | 
			
		||||
                    doc.save()
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
                obj_dict = {
 | 
			
		||||
@@ -263,6 +269,9 @@ class Command(BaseCommand):
 | 
			
		||||
                args = [arg if arg and arg != "NULL" else None for arg in args]
 | 
			
		||||
 | 
			
		||||
                if Document.objects.filter(file=args[0]).exists():
 | 
			
		||||
                    doc = Document.objects.get(file=args[0])
 | 
			
		||||
                    doc.uploaded_at = args[5].replace(" ", "T")
 | 
			
		||||
                    doc.save()
 | 
			
		||||
                    continue
 | 
			
		||||
 | 
			
		||||
                obj_dict = {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user