Skip to content

Commit

Permalink
Add ordering to City and State models
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtycoder committed Jul 3, 2017
1 parent 595f752 commit 408fa21
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pets/cities/migrations/0003_auto_20170702_2359.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cities', '0002_auto_20170601_2123'),
]

operations = [
migrations.AlterModelOptions(
name='city',
options={'ordering': ['search_name']},
),
migrations.AlterModelOptions(
name='state',
options={'ordering': ['name']},
),
]
6 changes: 6 additions & 0 deletions pets/cities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class State(models.Model):
name = models.CharField(max_length=50)
abbr = models.CharField(max_length=2)

class Meta:
ordering = ['name']

def __str__(self):
return self.name

Expand All @@ -21,6 +24,9 @@ class City(models.Model):

objects = CityQuerySet.as_manager()

class Meta:
ordering = ['search_name']

def __str__(self):
return self.name

Expand Down

0 comments on commit 408fa21

Please sign in to comment.