Convert a `datetime` object to a string representation (which will be stored in MongoDB). This is the reverse function of `_convert_from_string`. >>> a = datetime(2011, 6, 8, 20, 26, 24, 92284) >>> ComplexDateTimeField()._convert_from_datetime(a) '20
(self, val)
| 641 | super().__init__(**kwargs) |
| 642 | |
| 643 | def _convert_from_datetime(self, val): |
| 644 | """ |
| 645 | Convert a `datetime` object to a string representation (which will be |
| 646 | stored in MongoDB). This is the reverse function of |
| 647 | `_convert_from_string`. |
| 648 | |
| 649 | >>> a = datetime(2011, 6, 8, 20, 26, 24, 92284) |
| 650 | >>> ComplexDateTimeField()._convert_from_datetime(a) |
| 651 | '2011,06,08,20,26,24,092284' |
| 652 | """ |
| 653 | return val.strftime(self.format) |
| 654 | |
| 655 | def _convert_from_string(self, data): |
| 656 | """ |
no outgoing calls
no test coverage detected