def create_character(character_id, character_name, corporation_id, corporation_name, corporation_ticker, alliance_id, alliance_name, user, api_id): if not EveCharacter.objects.filter(character_id=character_id).exists(): eve_char = EveCharacter() eve_char.character_id = character_id eve_char.character_name = character_name eve_char.corporation_id = corporation_id eve_char.corporation_name = corporation_name eve_char.corporation_ticker = corporation_ticker if int(corporation_id) == int(settings.ALLIANCE_ID): # print 'adding corp member' eve_char.alliance_id = corporation_id eve_char.alliance_name = corporation_name else: # print 'adding none corp member' eve_char.alliance_id = alliance_id eve_char.alliance_name = alliance_name eve_char.user = user eve_char.api_id = api_id eve_char.save()
def create_character(character_id, character_name, corporation_id, corporation_name, corporation_ticker, alliance_id, alliance_name, user, api_id): if not EveCharacter.objects.filter(character_id=character_id).exists(): eve_char = EveCharacter() eve_char.character_id = character_id eve_char.character_name = character_name eve_char.corporation_id = corporation_id eve_char.corporation_name = corporation_name eve_char.corporation_ticker = corporation_ticker eve_char.alliance_id = alliance_id eve_char.alliance_name = alliance_name eve_char.user = user eve_char.api_id = api_id eve_char.save()
def create_character(character_id, character_name, corporation_id, corporation_name, corporation_ticker, alliance_id, alliance_name, user, api_id): logger.debug("Creating model for character %s id %s" % (character_name, character_id)) if not EveCharacter.objects.filter(character_id=character_id).exists(): eve_char = EveCharacter() eve_char.character_id = character_id eve_char.character_name = character_name eve_char.corporation_id = corporation_id eve_char.corporation_name = corporation_name eve_char.corporation_ticker = corporation_ticker eve_char.alliance_id = alliance_id eve_char.alliance_name = alliance_name eve_char.user = user eve_char.api_id = api_id eve_char.save() logger.info("Created new character model %s for user %s" % (eve_char, user)) else: logger.warn("Attempting to create existing character model with id %s" % character_id)