# -*- coding: UTF-8 -*-
import datetime
from django.db import models
class Demo(models.Model):
class Meta:
db_table = 't_demo'
unique_char = models.CharField()
create_time = models.DateTimeField(default = datetime.datetime.now())
import datetime
from django.db import models
class Demo(models.Model):
class Meta:
db_table = 't_demo'
unique_char = models.CharField()
create_time = models.DateTimeField(default = datetime.datetime.now())
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "test.settings"
import time, datetime
from test import Demo
if __name__ == "__main__":
while True:
demo, created = Demo.objects.get_or_create(unique_char = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
time.sleep(1)