def create(self, *args, **kwargs): comments = kwargs.pop("comments", []) instance = super().create(*args, **kwargs) create_multiple(instance, comments, "comments") instance.save() return instance
def create(self, *args, **kwargs): study = kwargs.pop("study") group_exs = kwargs.pop("group_exs", []) descriptions = kwargs.pop("descriptions", []) comments = kwargs.pop("comments", []) #Comment = apps.get_model('comments', 'Comment') #Description = apps.get_model('comments', 'Description') groupset = super().create(*args, **kwargs) create_multiple(groupset, descriptions, "descriptions") create_multiple(groupset, comments, "comments") #create_multiple_bulk(groupset, "groupset", descriptions, Description) #create_multiple_bulk(groupset, "groupset", comments, Comment) study_group_exs = [] for group_ex in group_exs: if "parent_ex" in group_ex: for study_group_ex in study_group_exs: if study_group_ex.name == group_ex["parent_ex"]: group_ex["parent_ex"] = study_group_ex # create single group_ex group_ex["study"] = study group_ex["group_exs"] = study_group_exs study_group_ex = groupset.group_exs.create(**group_ex) study_group_exs.append(study_group_ex) groupset.save() return groupset
def create(self, *args, **kwargs): study = kwargs.pop("study") group_exs = kwargs.pop("group_exs", []) descriptions = kwargs.pop("descriptions", []) comments = kwargs.pop("comments", []) groupset = super().create(*args, **kwargs) create_multiple(groupset, descriptions, "descriptions") create_multiple(groupset, comments, "comments") study_group_exs = [] for group_ex in group_exs: if "parent_ex" in group_ex: for study_group_ex in study_group_exs: if study_group_ex.name == group_ex["parent_ex"]: group_ex["parent_ex"] = study_group_ex # create single group_ex group_ex["study"] = study group_ex["group_exs"] = study_group_exs study_group_ex = groupset.group_exs.create(**group_ex) study_group_exs.append(study_group_ex) groupset.save() # add characteristica from parents to the all_characteristica_normed if each group for group in groupset.groups: group.characteristica_all_normed.add(*group._characteristica_all_normed) return groupset
def create(self, *args, **kwargs): characteristica_ex = kwargs.pop("characteristica_ex", []) groups = kwargs.pop("groups", []) study = kwargs.pop("study") group_exs = kwargs.pop("group_exs") comments = kwargs.pop("comments", []) descriptions = kwargs.pop("descriptions", []) group_ex = super().create(*args, **kwargs) for characteristica_ex_single in characteristica_ex: characteristica_ex_single["count"] = characteristica_ex_single.get( "count", group_ex.count ) group_ex.characteristica_ex.create(**characteristica_ex_single) for group in groups: group["study"] = study group["group_exs"] = group_exs group_ex.groups.create(**group) create_multiple(group_ex, comments, "comments") create_multiple(group_ex, descriptions, "descriptions") group_ex.save() return group_ex
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