from django.db import models
from django.utils import timezone
from datetime import datetime

# Create your models here.


class DoorStatus(models.Model):
    datetime = models.DateTimeField(default=timezone.now)
    status = models.BooleanField(default=False)
    name = models.CharField(max_length=20)

    def __str__(self):
        return self.name


class OpenData(models.Model):
    opened = models.DateTimeField(default=timezone.now)
    closed = models.DateTimeField(default=timezone.now)
    total = models.IntegerField(default=0)

    def __str__(self):
        return str(self.opened)

from django.db import models
from django.utils import timezone
from datetime import datetime

# Create your models here.


class DoorStatus(models.Model):
    datetime = models.DateTimeField()
    status = models.BooleanField(default=False)
    name = models.CharField(max_length=20)

    def __str__(self):
        return self.name


class OpenData(models.Model):
    opened = models.DateTimeField()
    closed = models.DateTimeField()
    total = models.IntegerField(default=0)

    def __str__(self):
        return str(self.opened)

Remove default datetime in door
Remove default datetime in door

  from django.db import models
  from django.utils import timezone
  from datetime import datetime
  
  # Create your models here.
  
  
  class DoorStatus(models.Model):
-     datetime = models.DateTimeField(default=timezone.now)
+     datetime = models.DateTimeField()
      status = models.BooleanField(default=False)
      name = models.CharField(max_length=20)
  
      def __str__(self):
          return self.name
  
  
  class OpenData(models.Model):
-     opened = models.DateTimeField(default=timezone.now)
+     opened = models.DateTimeField()
-     closed = models.DateTimeField(default=timezone.now)
+     closed = models.DateTimeField()
      total = models.IntegerField(default=0)
  
      def __str__(self):
          return str(self.opened)
  
Remove default datetime in door
## Code Before:
from django.db import models
from django.utils import timezone
from datetime import datetime

# Create your models here.


class DoorStatus(models.Model):
    datetime = models.DateTimeField(default=timezone.now)
    status = models.BooleanField(default=False)
    name = models.CharField(max_length=20)

    def __str__(self):
        return self.name


class OpenData(models.Model):
    opened = models.DateTimeField(default=timezone.now)
    closed = models.DateTimeField(default=timezone.now)
    total = models.IntegerField(default=0)

    def __str__(self):
        return str(self.opened)

## Instruction:
Remove default datetime in door
## Code After:
from django.db import models
from django.utils import timezone
from datetime import datetime

# Create your models here.


class DoorStatus(models.Model):
    datetime = models.DateTimeField()
    status = models.BooleanField(default=False)
    name = models.CharField(max_length=20)

    def __str__(self):
        return self.name


class OpenData(models.Model):
    opened = models.DateTimeField()
    closed = models.DateTimeField()
    total = models.IntegerField(default=0)

    def __str__(self):
        return str(self.opened)
