57 initial_revision.title = new_renkan_title if new_renkan_title else "Untitled Renkan" |
57 initial_revision.title = new_renkan_title if new_renkan_title else "Untitled Renkan" |
58 initial_revision.creation_date = creation_date |
58 initial_revision.creation_date = creation_date |
59 initial_revision.modification_date = creation_date |
59 initial_revision.modification_date = creation_date |
60 initial_revision.creator = creator |
60 initial_revision.creator = creator |
61 initial_revision.last_updated_by = creator |
61 initial_revision.last_updated_by = creator |
62 logger.debug("CREATE RENKAN NEW CONTENT %r", new_renkan_content) |
|
63 if new_renkan_content: |
62 if new_renkan_content: |
64 new_renkan_content_dict = json.loads(new_renkan.validate_json_content(new_renkan_content)) |
63 new_renkan_content_dict = json.loads(new_renkan.validate_json_content(new_renkan_content)) |
65 logger.debug("CREATE RENKAN NEW CONTENT AFTER VALIDATE %r", new_renkan_content_dict) |
|
66 new_renkan_content_dict["created"] = str(creation_date) |
64 new_renkan_content_dict["created"] = str(creation_date) |
67 new_renkan_content_dict["updated"] = str(creation_date) |
65 new_renkan_content_dict["updated"] = str(creation_date) |
68 else: |
66 else: |
69 new_renkan_content_dict = { |
67 new_renkan_content_dict = { |
70 "id": str(new_renkan.renkan_guid), |
68 "id": str(new_renkan.renkan_guid), |
138 if (not timestamp) or ((self.current_revision is not None) and dateparse.parse_datetime(timestamp) < self.current_revision.modification_date): |
136 if (not timestamp) or ((self.current_revision is not None) and dateparse.parse_datetime(timestamp) < self.current_revision.modification_date): |
139 logger.error("SAVING RENKAN: provided timestamp is %r, which isn't current revision modification_date %r", timestamp, self.current_revision.modification_date) |
137 logger.error("SAVING RENKAN: provided timestamp is %r, which isn't current revision modification_date %r", timestamp, self.current_revision.modification_date) |
140 raise ValidationError(_("Cannot save, provided timestamp is invalid")) |
138 raise ValidationError(_("Cannot save, provided timestamp is invalid")) |
141 else: |
139 else: |
142 dt_timestamp = dateparse.parse_datetime(timestamp) |
140 dt_timestamp = dateparse.parse_datetime(timestamp) |
143 logger.debug("SAVE RENKAN create new revision %r", create_new_revision) |
|
144 |
141 |
145 if create_new_revision: |
142 if create_new_revision: |
146 revision_to_update = Revision(parent_renkan=self) |
143 revision_to_update = Revision(parent_renkan=self) |
147 revision_to_update.creator = updator |
144 revision_to_update.creator = updator |
148 else: |
145 else: |