mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-26 09:58:13 +08:00
21 lines
582 B
Python
21 lines
582 B
Python
from django.db import models
|
|
import socket
|
|
from django.utils.translation import ugettext_lazy as _
|
|
from picklefield import PickledObjectField
|
|
|
|
|
|
class Task(models.Model):
|
|
name = models.CharField(max_length=100)
|
|
func = models.CharField(max_length=256)
|
|
task = PickledObjectField()
|
|
result = PickledObjectField()
|
|
started = models.DateTimeField()
|
|
stopped = models.DateTimeField()
|
|
success = models.BooleanField(default=True)
|
|
|
|
def time_taken(self):
|
|
return (self.stopped - self.started).total_seconds()
|
|
|
|
class Meta:
|
|
app_label = 'django_q'
|