def create(self, *args, **kwargs): kwargs.pop("study") characteristica = kwargs.pop("characteristica", []) group_exs = kwargs.pop("group_exs") if kwargs.get("parent"): for group_ex in group_exs: if group_ex.name == kwargs["parent"]: ex = group_ex kwargs["parent"] = self.model.objects.get( name=kwargs.get("parent"), ex=ex) group = super().create(*args, **kwargs) characteristica_updated = [] Characteristica = apps.get_model('subjects', 'Characteristica') for characteristica_single in characteristica: characteristica_single["count"] = characteristica_single.get( "count", group.count) characteristica_updated.append(characteristica_single) not_norm_group = create_multiple_bulk(group, "group", characteristica_updated, Characteristica) create_multiple_bulk_normalized(not_norm_group, Characteristica) group.save() return group
def create(self, *args, **kwargs): characteristica = kwargs.pop("characteristica", []) individual = super().create(*args, **kwargs) Characteristica = apps.get_model('subjects', 'Characteristica') not_norm_individual = create_multiple_bulk(individual, "individual", characteristica, Characteristica) create_multiple_bulk_normalized(not_norm_individual, Characteristica) individual.save() return individual
def create(self, *args, **kwargs): characteristica_ex = kwargs.pop("characteristica_ex", []) individuals = kwargs.pop("individuals", []) comments = kwargs.pop("comments", []) Comment = apps.get_model('comments', 'Comment') individual_ex = super().create(*args, **kwargs) create_multiple(individual_ex, characteristica_ex, "characteristica_ex") create_multiple(individual_ex, individuals, "individuals") #create_multiple(individual_ex, comments, "comments") create_multiple_bulk(individual_ex, "ex", comments, Comment) individual_ex.save() return individual_ex
def create(self, *args, **kwargs): individual_exs = kwargs.pop("individual_exs", []) descriptions = kwargs.pop("descriptions", []) kwargs.pop("study") comments = kwargs.pop("comments", []) Comment = apps.get_model('comments', 'Comment') Description = apps.get_model('comments', 'Description') individualset = super().create(*args, **kwargs) #create_multiple(individualset, descriptions, "descriptions") #create_multiple_bulk(individualset,"individualset", individual_exs, IndividualEx) create_multiple(individualset, individual_exs, "individual_exs") create_multiple_bulk(individualset, "individualset", descriptions, Description) create_multiple_bulk(individualset, "individualset", comments, Comment) individualset.save() return individualset
def create(self, *args, **kwargs): individual_exs = kwargs.pop("individual_exs", []) descriptions = kwargs.pop("descriptions", []) kwargs.pop("study") comments = kwargs.pop("comments", []) Comment = apps.get_model('comments', 'Comment') Description = apps.get_model('comments', 'Description') individualset = super().create(*args, **kwargs) # create_multiple(individualset, descriptions, "descriptions") # create_multiple_bulk(individualset,"individualset", individual_exs, IndividualEx) create_multiple(individualset, individual_exs, "individual_exs") create_multiple_bulk(individualset, "individualset", descriptions, Description) create_multiple_bulk(individualset, "individualset", comments, Comment) individualset.save() # add characteristica from parents to the all_characteristica_normed if each individual for individual in individualset.individuals: # print(individual._characteristica_all_normed.all()) individual.characteristica_all_normed.add(*individual._characteristica_all_normed) return individualset