from django.db import models
from django.conf import settings


class Task(models.Model):
    title = models.CharField(max_length=50, unique=True)
    created_at = models.DateField()
    status = models.CharField(max_length=30, choices=settings.TASK_CHOICES)

    def __unicode__(self):  # pragma: no cover
        return self.title

import datetime

from django.db import models
from django.conf import settings


class Task(models.Model):
    title = models.CharField(max_length=50, unique=True)
    created_at = models.DateTimeField(auto_now_add=True)
    status = models.CharField(max_length=30, choices=settings.TASK_CHOICES)

    class Meta:
        ordering = ('-created_at',)

    def __unicode__(self):  # pragma: no cover
        return self.title

Set order getting the list of tasks
Set order getting the list of tasks

+ import datetime
+ 
  from django.db import models
  from django.conf import settings
  
  
  class Task(models.Model):
      title = models.CharField(max_length=50, unique=True)
-     created_at = models.DateField()
+     created_at = models.DateTimeField(auto_now_add=True)
      status = models.CharField(max_length=30, choices=settings.TASK_CHOICES)
+ 
+     class Meta:
+         ordering = ('-created_at',)
  
      def __unicode__(self):  # pragma: no cover
          return self.title
  
Set order getting the list of tasks
## Code Before:
from django.db import models
from django.conf import settings


class Task(models.Model):
    title = models.CharField(max_length=50, unique=True)
    created_at = models.DateField()
    status = models.CharField(max_length=30, choices=settings.TASK_CHOICES)

    def __unicode__(self):  # pragma: no cover
        return self.title

## Instruction:
Set order getting the list of tasks
## Code After:
import datetime

from django.db import models
from django.conf import settings


class Task(models.Model):
    title = models.CharField(max_length=50, unique=True)
    created_at = models.DateTimeField(auto_now_add=True)
    status = models.CharField(max_length=30, choices=settings.TASK_CHOICES)

    class Meta:
        ordering = ('-created_at',)

    def __unicode__(self):  # pragma: no cover
        return self.title
