def _import_from_aa_fat(self) -> None: """ Start the import :return: :rtype: """ # Check if AA FAT is active if aa_fat_installed(): self.stdout.write( self.style.SUCCESS( "Alliance Auth FAT module is active, let's go!")) # First, we check if the target tables are empty ... current_afat_links_count = AFatLink.objects.all().count() current_afat_count = AFat.objects.all().count() if current_afat_count > 0 or current_afat_links_count > 0: self.stdout.write( self.style.WARNING( "You already have FAT data with the AFAT module. " "Import cannot be continued.")) return aa_fatlinks = Fatlink.objects.all() for aa_fatlink in aa_fatlinks: self.stdout.write( f"Importing FAT link for fleet '{aa_fatlink.fleet}' with hash " f"'{aa_fatlink.hash}'.") afatlink = AFatLink() afatlink.id = aa_fatlink.id afatlink.afattime = aa_fatlink.fatdatetime afatlink.fleet = (aa_fatlink.fleet if aa_fatlink.fleet is not None else aa_fatlink.hash) afatlink.hash = aa_fatlink.hash afatlink.creator_id = aa_fatlink.creator_id afatlink.save() # Write to log table log_text = f"FAT link {aa_fatlink.hash} with name {aa_fatlink.fleet} was created by {aa_fatlink.creator}" afatlog = AFatLog() afatlog.log_time = aa_fatlink.fatdatetime afatlog.log_event = AFatLog.Event.CREATE_FATLINK afatlog.log_text = log_text afatlog.user_id = aa_fatlink.creator_id afatlog.save() aa_fats = Fat.objects.all() for aa_fat in aa_fats: self.stdout.write( f"Importing FATs for FAT link ID '{aa_fat.id}'.") afat = AFat() afat.id = aa_fat.id afat.system = aa_fat.system afat.shiptype = aa_fat.shiptype afat.character_id = aa_fat.character_id afat.afatlink_id = aa_fat.fatlink_id afat.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the Alliance Auth FAT " "module in your local.py")) else: self.stdout.write( self.style.WARNING("Alliance Auth FAT module is not active. " "Please make sure you have it in your " "INSTALLED_APPS in your local.py!"))
def _import_from_imicusfat(self) -> None: # check if AA FAT is active if bfat_installed(): self.stdout.write( self.style.SUCCESS("ImicusFAT module is active, let's go!")) # first we check if the target tables are really empty ... current_afat_count = AFat.objects.all().count() current_afat_dellog_count = AFatDelLog.objects.all().count() current_afat_links_count = AFatLink.objects.all().count() current_afat_clickduration_count = ClickAFatDuration.objects.all( ).count() current_afat_manualfat_count = ManualAFat.objects.all().count() if (current_afat_count > 0 or current_afat_dellog_count > 0 or current_afat_links_count > 0 or current_afat_clickduration_count > 0 or current_afat_manualfat_count > 0): self.stdout.write( self.style.WARNING( "You already have FAT data with the AFAT module. " "Import cannot be continued.")) return # import FAT links bfat_fatlinks = BfatFatLink.objects.all() for bfat_fatlink in bfat_fatlinks: self.stdout.write( "Importing FAT link for fleet '{fleet}' with hash '{fatlink_hash}'." .format( fleet=bfat_fatlink.fleet, fatlink_hash=bfat_fatlink.hash, )) afatlink = AFatLink() afatlink.id = bfat_fatlink.id afatlink.afattime = bfat_fatlink.fattime afatlink.fleet = bfat_fatlink.fleet afatlink.hash = bfat_fatlink.hash afatlink.creator_id = bfat_fatlink.creator_id afatlink.save() # import FATs bfat_fats = BfatFat.objects.all() for bfat_fat in bfat_fats: self.stdout.write( "Importing FATs for FAT link ID '{fatlink_id}'.".format( fatlink_id=bfat_fat.id)) afat = AFat() afat.id = bfat_fat.id afat.system = bfat_fat.system afat.shiptype = bfat_fat.shiptype afat.character_id = bfat_fat.character_id afat.afatlink_id = bfat_fat.fatlink_id afat.save() # import click FAT durations bfat_clickfatdurations = BfatClickFatDuration.objects.all() for bfat_clickfatduration in bfat_clickfatdurations: self.stdout.write( "Importing FAT duration with ID '{duration_id}'.".format( duration_id=bfat_clickfatduration.id)) afat_clickfatduration = ClickAFatDuration() afat_clickfatduration.id = bfat_clickfatduration.id afat_clickfatduration.duration = bfat_clickfatduration.duration afat_clickfatduration.fleet_id = bfat_clickfatduration.fleet_id afat_clickfatduration.save() # import dellog bfat_dellogs = BfatDelLog.objects.all() for bfat_dellog in bfat_dellogs: self.stdout.write( "Importing FAT dellogwith ID '{dellog_id}'.".format( dellog_id=bfat_dellog.id)) afat_dellog = AFatDelLog() afat_dellog.id = bfat_dellog.id afat_dellog.deltype = bfat_dellog.deltype afat_dellog.string = bfat_dellog.string afat_dellog.remover_id = bfat_dellog.remover_id afat_dellog.save() # import manual fat bfat_manualfats = BfatManualFat.objects.all() for bfat_manualfat in bfat_manualfats: self.stdout.write( "Importing manual FAT with ID '{manualfat_id}'.".format( manualfat_id=bfat_manualfat.id)) afat_manualfat = ManualAFat() afat_manualfat.id = bfat_manualfat.id afat_manualfat.character_id = bfat_manualfat.character_id afat_manualfat.creator_id = bfat_manualfat.creator_id afat_manualfat.afatlink_id = bfat_manualfat.fatlink_id afat_manualfat.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the bFAT module in your local.py")) else: self.stdout.write( self.style.WARNING( "bFAT module is not active. " "Please make sure you have it in your INSTALLED_APPS in your local.py!" ))
def _import_from_imicusfat(self) -> None: """ Start the import :return: :rtype: """ # First, we check if the target tables are empty ... current_afat_count = AFat.objects.all().count() current_afat_links_count = AFatLink.objects.all().count() current_afat_linktype_count = AFatLinkType.objects.all().count() current_afat_clickduration_count = ClickAFatDuration.objects.all().count() if ( current_afat_count > 0 or current_afat_links_count > 0 or current_afat_linktype_count > 0 or current_afat_clickduration_count > 0 ): self.stdout.write( self.style.WARNING( "You already have FAT data with the aFAT module. " "Import cannot be continued." ) ) return # Before we do anything, remove all "deleted" FATlinks and FATs IFatLink.all_objects.filter(deleted_at__isnull=False).hard_delete() IFat.all_objects.filter(deleted_at__isnull=False).hard_delete() # Import fat link type imicusfat_fleettypes = IFatLinkType.objects.all() for imicusfat_fleettype in imicusfat_fleettypes: self.stdout.write(f"Importing fleet type '{imicusfat_fleettype.name}'.") afat_fleettype = AFatLinkType() afat_fleettype.id = imicusfat_fleettype.id afat_fleettype.name = imicusfat_fleettype.name afat_fleettype.is_enabled = imicusfat_fleettype.is_enabled afat_fleettype.save() # Import FAT links imicusfat_fatlinks = IFatLink.objects.all() for imicusfat_fatlink in imicusfat_fatlinks: fleet = imicusfat_fatlink.fleet fatlink_hash = imicusfat_fatlink.hash fatlink_name = imicusfat_fatlink.fleet fatlink_creator = imicusfat_fatlink.creator self.stdout.write( f"Importing FAT link for fleet '{fleet}' with hash '{fatlink_hash}'." ) afatlink = AFatLink() afatlink.id = imicusfat_fatlink.id afatlink.afattime = imicusfat_fatlink.ifattime afatlink.fleet = ( imicusfat_fatlink.fleet if imicusfat_fatlink.fleet is not None else fatlink_hash ) afatlink.hash = fatlink_hash afatlink.creator_id = imicusfat_fatlink.creator_id afatlink.link_type_id = imicusfat_fatlink.link_type_id afatlink.is_esilink = imicusfat_fatlink.is_esilink afatlink.save() # Write to log table if imicusfat_fatlink.is_esilink: log_text = ( f"ESI FAT link {fatlink_hash} with name {fatlink_name} " f"was created by {fatlink_creator}" ) else: try: fleet_duration = ClickIFatDuration.objects.get( fleet_id=imicusfat_fatlink.id ) log_text = ( f"FAT link {fatlink_hash} with name {fatlink_name} and a " f"duration of {fleet_duration.duration} minutes was created " f"by {fatlink_creator}" ) except ClickIFatDuration.DoesNotExist: log_text = ( f"FAT link {fatlink_hash} with name {fatlink_name} " f"was created by {fatlink_creator}" ) afatlog = AFatLog() afatlog.log_time = imicusfat_fatlink.ifattime afatlog.log_event = AFatLog.Event.CREATE_FATLINK afatlog.log_text = log_text afatlog.user_id = imicusfat_fatlink.creator_id afatlog.save() # Import FATs imicustaf_fats = IFat.objects.all() for imicusfat_fat in imicustaf_fats: self.stdout.write(f"Importing FATs for FAT link ID '{imicusfat_fat.id}'.") afat = AFat() afat.id = imicusfat_fat.id afat.system = imicusfat_fat.system afat.shiptype = imicusfat_fat.shiptype afat.character_id = imicusfat_fat.character_id afat.afatlink_id = imicusfat_fat.ifatlink_id afat.save() # Import click FAT durations imicusfat_clickfatdurations = ClickIFatDuration.objects.all() for imicusfat_clickfatduration in imicusfat_clickfatdurations: self.stdout.write( f"Importing FAT duration with ID '{imicusfat_clickfatduration.id}'." ) afat_clickfatduration = ClickAFatDuration() afat_clickfatduration.id = imicusfat_clickfatduration.id afat_clickfatduration.duration = imicusfat_clickfatduration.duration afat_clickfatduration.fleet_id = imicusfat_clickfatduration.fleet_id afat_clickfatduration.save() # Import manual fat to log table imicusfat_manualfats = ManualIFat.objects.all() for imicusfat_manualfat in imicusfat_manualfats: self.stdout.write( f"Importing manual FAT with ID '{imicusfat_manualfat.id}'." ) fatlink = IFatLink.objects.get(manualifat=imicusfat_manualfat) pilot_name = imicusfat_manualfat.character.character_name log_text = ( f"Pilot {pilot_name} was manually added to " f'FAT link with hash "{fatlink.hash}"' ) if imicusfat_manualfat.created_at is not None: afatlog = AFatLog() afatlog.log_time = imicusfat_manualfat.created_at afatlog.log_event = AFatLog.Event.MANUAL_FAT afatlog.log_text = log_text afatlog.user_id = imicusfat_manualfat.creator_id afatlog.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the ImicusFAT module in your local.py" ) )
def _import_from_imicusfat(self) -> None: """ start the import :return: :rtype: """ # check if AA FAT is active if bfat_installed(): self.stdout.write( self.style.SUCCESS("ImicusFAT module is active, let's go!")) # first we check if the target tables are really empty ... current_afat_count = AFat.objects.all().count() current_afat_links_count = AFatLink.objects.all().count() current_afat_clickduration_count = ClickAFatDuration.objects.all( ).count() if (current_afat_count > 0 or current_afat_links_count > 0 or current_afat_clickduration_count > 0): self.stdout.write( self.style.WARNING( "You already have FAT data with the AFAT module. " "Import cannot be continued.")) return # import FAT links bfat_fatlinks = BfatFatLink.objects.all() for bfat_fatlink in bfat_fatlinks: self.stdout.write( f'Importing FAT link for fleet "{bfat_fatlink.fleet}" ' f'with hash "{bfat_fatlink.hash}".') afatlink = AFatLink() afatlink.id = bfat_fatlink.id afatlink.afattime = bfat_fatlink.fattime afatlink.fleet = bfat_fatlink.fleet afatlink.hash = bfat_fatlink.hash afatlink.creator_id = bfat_fatlink.creator_id afatlink.save() # write to log table try: fleet_duration = BfatClickFatDuration.objects.get( fleet_id=bfat_fatlink.id) log_text = ( f'FAT link "{bfat_fatlink.hash}" with name ' f'"{bfat_fatlink.fleet}" and a duration of ' f"{fleet_duration.duration} minutes was created " f"by {bfat_fatlink.creator}") except BfatClickFatDuration.DoesNotExist: log_text = ( f'FAT link "{bfat_fatlink.hash}" with name ' f'"{bfat_fatlink.fleet}" was created by {bfat_fatlink.creator}' ) if bfat_fatlink.fattime is not None: afatlog = AFatLog() afatlog.log_time = bfat_fatlink.fattime afatlog.log_event = AFatLogEvent.CREATE_FATLINK afatlog.log_text = log_text afatlog.user_id = bfat_fatlink.creator_id afatlog.save() # import FATs bfat_fats = BfatFat.objects.all() for bfat_fat in bfat_fats: self.stdout.write( f"Importing FATs for FAT link ID {bfat_fat.id}.") afat = AFat() afat.id = bfat_fat.id afat.system = bfat_fat.system afat.shiptype = bfat_fat.shiptype afat.character_id = bfat_fat.character_id afat.afatlink_id = bfat_fat.fatlink_id afat.save() # import click FAT durations bfat_clickfatdurations = BfatClickFatDuration.objects.all() for bfat_clickfatduration in bfat_clickfatdurations: self.stdout.write( f"Importing FAT duration with ID {bfat_clickfatduration.id}." ) afat_clickfatduration = ClickAFatDuration() afat_clickfatduration.id = bfat_clickfatduration.id afat_clickfatduration.duration = bfat_clickfatduration.duration afat_clickfatduration.fleet_id = bfat_clickfatduration.fleet_id afat_clickfatduration.save() # import manual fat bfat_manualfats = BfatManualFat.objects.all() for bfat_manualfat in bfat_manualfats: self.stdout.write( f"Importing manual FAT with ID {bfat_manualfat.id}.") fatlink = BfatFatLink.objects.get(manualfat=bfat_manualfat) log_text = ( f"Pilot {bfat_manualfat.character.character_name} was manually " f'added to FAT link with hash "{fatlink.hash}"') afatlog = AFatLog() afatlog.log_time = bfat_manualfat.created_at afatlog.log_event = AFatLogEvent.MANUAL_FAT afatlog.log_text = log_text afatlog.user_id = bfat_manualfat.creator_id afatlog.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the bFAT module in your local.py")) else: self.stdout.write( self.style.WARNING("bFAT module is not active. " "Please make sure you have it in your " "INSTALLED_APPS in your local.py!"))
def _import_from_aa_fat(self) -> None: # check if AA FAT is active if aa_fat_installed(): self.stdout.write( self.style.SUCCESS("Alliance Auth FAT module is active, let's go!") ) # first we check if the target tables are really empty ... current_afat_links_count = AFatLink.objects.all().count() current_afat_count = AFat.objects.all().count() if current_afat_count > 0 or current_afat_links_count > 0: self.stdout.write( self.style.WARNING( "You already have FAT data with the AFAT module. " "Import cannot be continued." ) ) return aa_fatlinks = Fatlink.objects.all() for aa_fatlink in aa_fatlinks: self.stdout.write( "Importing FAT link for fleet '{fleet}' with hash '{fatlink_hash}'.".format( fleet=aa_fatlink.fleet, fatlink_hash=aa_fatlink.hash ) ) afatlink = AFatLink() afatlink.id = aa_fatlink.id afatlink.afattime = aa_fatlink.fatdatetime afatlink.fleet = aa_fatlink.fleet afatlink.hash = aa_fatlink.hash afatlink.creator_id = aa_fatlink.creator_id afatlink.save() aa_fats = Fat.objects.all() for aa_fat in aa_fats: self.stdout.write( "Importing FATs for FAT link ID '{fatlink_id}'.".format( fatlink_id=aa_fat.id ) ) afat = AFat() afat.id = aa_fat.id afat.system = aa_fat.system afat.shiptype = aa_fat.shiptype afat.character_id = aa_fat.character_id afat.afatlink_id = aa_fat.fatlink_id afat.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the Alliance Auth FAT module in your local.py" ) ) else: self.stdout.write( self.style.WARNING( "Alliance Auth FAT module is not active. " "Please make sure you have it in your INSTALLES_APPS in your local.py!" ) )
def _import_from_imicusfat(self) -> None: # first we check if the target tables are really empty ... current_afat_count = AFat.objects.all().count() current_afat_dellog_count = AFatDelLog.objects.all().count() current_afat_links_count = AFatLink.objects.all().count() current_afat_linktype_count = AFatLinkType.objects.all().count() current_afat_clickduration_count = ClickAFatDuration.objects.all( ).count() current_afat_manualfat_count = ManualAFat.objects.all().count() if (current_afat_count > 0 or current_afat_dellog_count > 0 or current_afat_links_count > 0 or current_afat_linktype_count > 0 or current_afat_clickduration_count > 0 or current_afat_manualfat_count > 0): self.stdout.write( self.style.WARNING( "You already have FAT data with the aFAT module. " "Import cannot be continued.")) return # import fatlinktype imicusfat_fleettypes = IFatLinkType.objects.all() for imicusfat_fleettype in imicusfat_fleettypes: self.stdout.write("Importing fleet type '{fleet_type}'.".format( fleet_type=imicusfat_fleettype.name)) afat_fleettype = AFatLinkType() afat_fleettype.id = imicusfat_fleettype.id afat_fleettype.name = imicusfat_fleettype.name afat_fleettype.deleted_at = imicusfat_fleettype.deleted_at afat_fleettype.is_enabled = imicusfat_fleettype.is_enabled afat_fleettype.save() # import FAT links imicusfat_fatlinks = IFatLink.objects.all() for imicusfat_fatlink in imicusfat_fatlinks: self.stdout.write( "Importing FAT link for fleet '{fleet}' with hash '{fatlink_hash}'." .format( fleet=imicusfat_fatlink.fleet, fatlink_hash=imicusfat_fatlink.hash, )) afatlink = AFatLink() afatlink.id = imicusfat_fatlink.id afatlink.afattime = imicusfat_fatlink.ifattime afatlink.fleet = imicusfat_fatlink.fleet afatlink.hash = imicusfat_fatlink.hash afatlink.creator_id = imicusfat_fatlink.creator_id afatlink.deleted_at = imicusfat_fatlink.deleted_at afatlink.link_type_id = imicusfat_fatlink.link_type_id afatlink.is_esilink = imicusfat_fatlink.is_esilink afatlink.save() # import FATs imicustaf_fats = IFat.objects.all() for imicusfat_fat in imicustaf_fats: self.stdout.write( "Importing FATs for FAT link ID '{fatlink_id}'.".format( fatlink_id=imicusfat_fat.id)) afat = AFat() afat.id = imicusfat_fat.id afat.system = imicusfat_fat.system afat.shiptype = imicusfat_fat.shiptype afat.character_id = imicusfat_fat.character_id afat.afatlink_id = imicusfat_fat.ifatlink_id afat.deleted_at = imicusfat_fat.deleted_at afat.save() # import click FAT durations imicusfat_clickfatdurations = ClickIFatDuration.objects.all() for imicusfat_clickfatduration in imicusfat_clickfatdurations: self.stdout.write( "Importing FAT duration with ID '{duration_id}'.".format( duration_id=imicusfat_clickfatduration.id)) afat_clickfatduration = ClickAFatDuration() afat_clickfatduration.id = imicusfat_clickfatduration.id afat_clickfatduration.duration = imicusfat_clickfatduration.duration afat_clickfatduration.fleet_id = imicusfat_clickfatduration.fleet_id afat_clickfatduration.save() # import dellog imicusfat_dellogs = IFatDelLog.objects.all() for imicusfat_dellog in imicusfat_dellogs: self.stdout.write( "Importing FAT dellogwith ID '{dellog_id}'.".format( dellog_id=imicusfat_dellog.id)) afat_dellog = AFatDelLog() afat_dellog.id = imicusfat_dellog.id afat_dellog.deltype = imicusfat_dellog.deltype afat_dellog.string = imicusfat_dellog.string afat_dellog.remover_id = imicusfat_dellog.remover_id afat_dellog.save() # import manual fat imicusfat_manualfats = ManualIFat.objects.all() for imicusfat_manualfat in imicusfat_manualfats: self.stdout.write( "Importing manual FAT with ID '{manualfat_id}'.".format( manualfat_id=imicusfat_manualfat.id)) afat_manualfat = ManualAFat() afat_manualfat.id = imicusfat_manualfat.id afat_manualfat.character_id = imicusfat_manualfat.character_id afat_manualfat.creator_id = imicusfat_manualfat.creator_id afat_manualfat.afatlink_id = imicusfat_manualfat.ifatlink_id afat_manualfat.created_at = imicusfat_manualfat.created_at afat_manualfat.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the ImicusFAT module in your local.py") )
def _import_from_imicusfat(self) -> None: """ start the import :return: :rtype: """ # first we check if the target tables are really empty ... current_afat_count = AFat.objects.all().count() current_afat_links_count = AFatLink.objects.all().count() current_afat_linktype_count = AFatLinkType.objects.all().count() current_afat_clickduration_count = ClickAFatDuration.objects.all( ).count() if (current_afat_count > 0 or current_afat_links_count > 0 or current_afat_linktype_count > 0 or current_afat_clickduration_count > 0): self.stdout.write( self.style.WARNING( "You already have FAT data with the aFAT module. " "Import cannot be continued.")) return # import fatlinktype imicusfat_fleettypes = IFatLinkType.objects.all() for imicusfat_fleettype in imicusfat_fleettypes: self.stdout.write("Importing fleet type '{fleet_type}'.".format( fleet_type=imicusfat_fleettype.name)) afat_fleettype = AFatLinkType() afat_fleettype.id = imicusfat_fleettype.id afat_fleettype.name = imicusfat_fleettype.name afat_fleettype.is_enabled = imicusfat_fleettype.is_enabled afat_fleettype.save() # import FAT links imicusfat_fatlinks = IFatLink.objects.all() for imicusfat_fatlink in imicusfat_fatlinks: self.stdout.write("Importing FAT link for fleet '{fleet}' with " "hash '{fatlink_hash}'.".format( fleet=imicusfat_fatlink.fleet, fatlink_hash=imicusfat_fatlink.hash, )) afatlink = AFatLink() afatlink.id = imicusfat_fatlink.id afatlink.afattime = imicusfat_fatlink.ifattime afatlink.fleet = imicusfat_fatlink.fleet afatlink.hash = imicusfat_fatlink.hash afatlink.creator_id = imicusfat_fatlink.creator_id afatlink.link_type_id = imicusfat_fatlink.link_type_id afatlink.is_esilink = imicusfat_fatlink.is_esilink afatlink.save() # write to log table if imicusfat_fatlink.is_esilink: log_text = ( "ESI FAT link {fatlink_hash} with name {name} was created by {user}" ).format( fatlink_hash=imicusfat_fatlink.hash, name=imicusfat_fatlink.fleet, user=imicusfat_fatlink.creator, ) else: try: fleet_duration = ClickIFatDuration.objects.get( fleet_id=imicusfat_fatlink.id) log_text = ( "FAT link {fatlink_hash} with name {name} and a " "duration of {duration} minutes was created by {user}" ).format( fatlink_hash=imicusfat_fatlink.hash, name=imicusfat_fatlink.fleet, duration=fleet_duration.duration, user=imicusfat_fatlink.creator, ) except ClickIFatDuration.DoesNotExist: log_text = ( "FAT link {fatlink_hash} with name {name} was created by {user}" ).format( fatlink_hash=imicusfat_fatlink.hash, name=imicusfat_fatlink.fleet, user=imicusfat_fatlink.creator, ) afatlog = AFatLog() afatlog.log_time = imicusfat_fatlink.ifattime afatlog.log_event = AFatLogEvent.CREATE_FATLINK afatlog.log_text = log_text afatlog.user_id = imicusfat_fatlink.creator_id afatlog.save() # import FATs imicustaf_fats = IFat.objects.all() for imicusfat_fat in imicustaf_fats: self.stdout.write( "Importing FATs for FAT link ID '{fatlink_id}'.".format( fatlink_id=imicusfat_fat.id)) afat = AFat() afat.id = imicusfat_fat.id afat.system = imicusfat_fat.system afat.shiptype = imicusfat_fat.shiptype afat.character_id = imicusfat_fat.character_id afat.afatlink_id = imicusfat_fat.ifatlink_id afat.save() # import click FAT durations imicusfat_clickfatdurations = ClickIFatDuration.objects.all() for imicusfat_clickfatduration in imicusfat_clickfatdurations: self.stdout.write( "Importing FAT duration with ID '{duration_id}'.".format( duration_id=imicusfat_clickfatduration.id)) afat_clickfatduration = ClickAFatDuration() afat_clickfatduration.id = imicusfat_clickfatduration.id afat_clickfatduration.duration = imicusfat_clickfatduration.duration afat_clickfatduration.fleet_id = imicusfat_clickfatduration.fleet_id afat_clickfatduration.save() # import manual fat to log table imicusfat_manualfats = ManualIFat.objects.all() for imicusfat_manualfat in imicusfat_manualfats: self.stdout.write( "Importing manual FAT with ID '{manualfat_id}'.".format( manualfat_id=imicusfat_manualfat.id)) fatlink = IFatLink.objects.get(manualifat=imicusfat_manualfat) log_text = ( "Pilot {pilot_name} was manually added to " 'FAT link with hash "{fatlink_hash}"').format( pilot_name=imicusfat_manualfat.character.character_name, fatlink_hash=fatlink.hash, ) if imicusfat_manualfat.created_at is not None: afatlog = AFatLog() afatlog.log_time = imicusfat_manualfat.created_at afatlog.log_event = AFatLogEvent.MANUAL_FAT afatlog.log_text = log_text afatlog.user_id = imicusfat_manualfat.creator_id afatlog.save() self.stdout.write( self.style.SUCCESS( "Import complete! " "You can now deactivate the ImicusFAT module in your local.py") )