title: Django Sort ManyToMany Field in A Nonsignificant Order
body: <p>I have two models as below:</p>
  
  <pre><code>class Stop(models.Model):
      """
      Showing bus stops in İzmir.
      """
  
      code = models.PositiveIntegerField(
          unique=True,
          primary_key=True,
          verbose_name="Code"
      )
  
      label = models.CharField(
          null=False,
          blank=False,
          max_length=64,
          verbose_name="Label"
      )
  
      coor = ArrayField(
          models.FloatField(),
          size=2,
          verbose_name="Coordination"
      )
  
      class Meta:
          verbose_name = "Stop"
          verbose_name_plural = "Stops"
          ordering = ["label"]
  
      def __str__(self):
          return self.label
  
  class Route(models.Model):
      """
      Bus routes of İzmir.
      """
  
      code = models.PositiveSmallIntegerField(
          unique=True,
          primary_key=True,
          verbose_name="Code"
      )
  
      stops = models.ManyToManyField(
          Stop,
          null=True,
          blank=True,
          related_name="routes",
          verbose_name="Stops"
      )
  
      terminals = ArrayField(
          models.CharField(
              null=False,
              blank=False,
              max_length=32,
          ),
          size=2,
          default=[],
          verbose_name="Terminals"
      )
  
      departure_times = ArrayField(
          ArrayField(
              models.TimeField(
                  null=False,
                  blank=False
              ),
              null=True,
              default=[]
          ),
          default=[],
          size=6,
          verbose_name="Departure Times"
      )
  
      class Meta:
          verbose_name = "Route"
          verbose_name_plural = "Routes"
          ordering = ["code"]
  
      def __str__(self):
          return "{}: {} - {}".format(str(self.code), self.terminals[0], self.terminals[1])
  </code></pre>
  
  <p>As you can see, <code>Route</code> has a <code>ManyToManyFields</code> which takes <code>Stop</code> instances.</p>
  
  <p>I put the instances with a script which it scraps a couple of web page, it seems I will use crontab to keep them updated. In the data I am scraping, <code>Stop</code> objects are ordered. The thing is, there are no significant filter to sort e.g. a <code>Stop</code> instance comes after another.</p>
  
  <p>Django (or Django Rest Framework) returns <code>Stop</code> instances of <code>Route</code> instance in alphabetic order, e.g.</p>
  
  <pre><code>{
      "code": 285,
      "terminals": [
          "EVKA 1",
          "KONAK"
      ],
      "stops": [
          40586,
          40633,
          12066,
          40645,
          40627,
          40647,
          40588,
          40592,
          40623,
          40016,
          40506,
          40508,
          40528,
          40462,
          40631,
          40014,
          40619,
          40530,
          12060,
          40661,
          40504,
          40488,
          40653,
          40590,
          40512,
          40464,
          10240,
          10036,
          12068,
          40514,
          40510,
          40658,
          40002,
          40649,
          12070,
          40004,
          40010,
          40656,
          12064,
          40614,
          40012
      ],
      ...
  }
  </code></pre>
  
  <p>In which <code>stops[0]</code> returns a <code>Stop</code> instance beginning with <code>A</code> and sorts like that.</p>
  
  <p>So, is there a way to order like a <code>list</code> in Python? Like, there is no significant point, you just append to the end and return so.</p>
  
  <hr>
  
  <h1>Environment</h1>
  
  <ul>
  <li>python 3.5.1</li>
  <li>django 1.9.7</li>
  <li>djangorestframework 3.3.3</li>
  <li>psycopg2 2.6.2</li>
  <li>postgresql 9.5</li>
  </ul>