Here is a snippet of how my models are setup:
class Profile(models.Model):
name = models.CharField(max_length=32)
accout = models.ManyToManyFie
Add the related name to ProfileAccounts and then change the ordering in Accounts with that 'related_name__number'. Note two underscores between related_name and number. See below:
class Accounts(models.Model):
.
.
.
class Meta:
ordering = ('profile_accounts__number',)
class ProfileAccounts(models.Model):
.
.
.
account = models.ForeignKey('project.Accounts', related_name='profile_accounts')
number = models.PositiveIntegerField()
class Meta:
ordering = ('number',)