Django Meta Class - Apply Ordering to user's model field

Viewed 18135

I am new to Django 1.9, I have an models.py :

class MyProfile(models.Model):

    user = models.OneToOneField(User, on_delete=models.CASCADE)
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    Role = ArrayField(models.CharField(max_length=1000), blank=True,null=True)
    ContactNumber = models.CharField(max_length=100)

    class Meta:
        ordering = ('date_joined',)

Here I want to order table using date_joined which is field of User model.

When I am trying to run python manage.py makemigrations it gives me error as follows:

SystemCheckError: System check identified some issues:

ERRORS:
projectmanagement.UniservedTeam: (models.E015) 'ordering' refers to the non-existent field 'date_joined'.

How do i achieve this?

1 Answers
Related