def to_model(self): # Create a citation object as in our models. Eventually, the version in # our models should probably be the only object named "Citation". Until # then, this function helps map from this object to the Citation object # in the models. c = ModelCitation( **{ key: value for key, value in self.__dict__.items() if key in ModelCitation._meta.get_all_field_names() }) c.type = self._get_cite_type() return c
def to_model(self): # Create a citation object as in our models. Eventually, the version in # our models should probably be the only object named "Citation". Until # then, this function helps map from this object to the Citation object # in the models. c = ModelCitation( **{ key: value for key, value in self.__dict__.items() if key in ModelCitation._meta.get_all_field_names() }) canon = REPORTERS[self.canonical_reporter] cite_type = canon[self.lookup_index]["cite_type"] c.type = map_reporter_db_cite_type(cite_type) return c