This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
2020-10-22 20:19:27 -04:00

39 lines
1.5 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)
term_date = models.DateField(
'Date to be terminated', null=True, blank=True)
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