37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
import datetime
|
|
import uuid
|
|
|
|
from django.db import models
|
|
from django.utils import timezone
|
|
|
|
|
|
class Migration(models.Model):
|
|
"""This is the migration class"""
|
|
id = models.CharField(max_length=200, unique=True,
|
|
default=uuid.uuid4, primary_key=True)
|
|
submit_time = models.DateField('migrtation submitted on')
|
|
domain = models.CharField(max_length=200)
|
|
booked_time = models.DateTimeField('Migration booked for')
|
|
original_server = models.CharField(max_length=200)
|
|
new_server = models.CharField(max_length=200)
|
|
username = models.CharField(max_length=200)
|
|
notes = models.CharField(max_length=1024, null=True, blank=True)
|
|
brand = models.CharField(max_length=200)
|
|
ticket_id = models.CharField(max_length=64)
|
|
migration_status = models.CharField(max_length=200, default='Booked')
|
|
agent_booked = models.CharField(max_length=10)
|
|
additional_domains = models.CharField(
|
|
max_length=500, null=True, blank=True)
|
|
migration_type = models.CharField(max_length=200)
|
|
is_urgent = models.BooleanField(default=False)
|
|
|
|
def print_missed_migrations(self):
|
|
now = timezone.now()
|
|
return now >= self.booked_time
|
|
print_missed_migrations.admin_order_field = 'booked_time'
|
|
print_missed_migrations.boolean = True
|
|
print_missed_migrations.short_description = "Was this migration missed?"
|
|
|
|
def __str__(self):
|
|
return self.domain + ' ' + self.ticket_id
|