OpenDroneMap-WebODM/app/models/preset.py

22 wiersze
1.0 KiB
Python
Czysty Zwykły widok Historia

2017-07-20 14:19:25 +00:00
import logging
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
from .task import validate_task_options
logger = logging.getLogger('app.logger')
class Preset(models.Model):
2017-07-25 17:54:41 +00:00
owner = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE, help_text="The person who owns this preset")
2017-07-21 20:48:01 +00:00
name = models.CharField(max_length=255, blank=False, null=False, help_text="A label used to describe the preset")
2019-01-16 15:47:35 +00:00
options = JSONField(default=list, blank=True, help_text="Options that define this preset (same format as in a Task's options).",
2017-07-20 14:19:25 +00:00
validators=[validate_task_options])
created_at = models.DateTimeField(default=timezone.now, help_text="Creation date")
system = models.BooleanField(db_index=True, default=False, help_text="Whether this preset is available to every user in the system or just to its owner.")
def __str__(self):
return self.name