Morning,
I am having trouble trying to record datetime with microseconds:
python3 / pymysql
*models.py*
class StampLog(models.Model):
stamp = models.ForeignKey(Stamp, related_name='logs')
bet_id = models.ForeignKey(Order, related_name='logs', null=True)
status = models.CharField(max_length=20)
status_log = models.CharField(max_length=500)
update_date = models.DateTimeField()
owner = models.ForeignKey('auth.User', related_name='logs')
created_date = models.DateTimeField(auto_now_add=True)
updated_date = models.DateTimeField(auto_now=True)
class Meta:
ordering = ('created_date',)
*serializers.py*
class StampLogSerializer(serializers.ModelSerializer):
class Meta:
model = StampLog
fields = ('stamp', 'bet_id', 'status', 'status_log', 'update_date')
extra_kwargs = {'stamp': {'write_only': True}}
When I create a new instance I get the following returned:
{'status_log': 'dfewfgergf', 'bet_id': 70754637374, 'update_date':
'2016-07-07T09:37:16.467884Z', 'status': 'another test'}
But in the db and when I query I get:
{'status_log': 'dfewfgergf', 'bet_id': 70754637374, 'update_date':
'2016-07-07T09:37:16Z', 'status': 'another test'}
I have tried updating the column datatype to DATETIME(6) but no luck, I think
microseconds may be being stripped during the insert (pymysql)
Thanks for any help
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.