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.

42 lines
1.7 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_date = models.DateField('Migration booked for')
booked_time = models.CharField(max_length=200)
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)
migration_cmd = models.CharField(max_length=200, null=True, blank=True)
is_urgent = models.BooleanField(default=False)
extra_scripts_run = models.BooleanField(default=False)
# def print_missed_migrations(self):
# now = timezone.date()
# return now >= self.booked_date and self.migration_status == 'Booked'
# 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