
from django.db import models


class DeviceManager(models.Manager):

    def latest(self):
        """ Returns latest Device instance """
        return self.latest('created_at')



from django.db import models


class DeviceManager(models.Manager):

    def get_latest(self):
        """ Returns latest Device instance """
        return self.get_queryset().latest('created_at')


Use .get_latest() instead so that we do not override built-in .latest()
Use .get_latest() instead so that we do not override built-in .latest()

  
  from django.db import models
  
  
  class DeviceManager(models.Manager):
  
-     def latest(self):
+     def get_latest(self):
          """ Returns latest Device instance """
-         return self.latest('created_at')
+         return self.get_queryset().latest('created_at')
  
  
Use .get_latest() instead so that we do not override built-in .latest()
## Code Before:

from django.db import models


class DeviceManager(models.Manager):

    def latest(self):
        """ Returns latest Device instance """
        return self.latest('created_at')


## Instruction:
Use .get_latest() instead so that we do not override built-in .latest()
## Code After:

from django.db import models


class DeviceManager(models.Manager):

    def get_latest(self):
        """ Returns latest Device instance """
        return self.get_queryset().latest('created_at')

