Permalink
Browse files

fixed PostalCodeAdmin

  • Loading branch information...
1 parent e9b46f9 commit f0355684f72077fdf710c2486bc95eb995e2cc3e @akabos akabos committed Oct 24, 2012
Showing with 8 additions and 9 deletions.
  1. +8 −9 cities/admin.py
View
17 cities/admin.py
@@ -4,36 +4,36 @@
class CountryAdmin(admin.ModelAdmin):
list_display = ['name', 'code', 'tld', 'population']
search_fields = ['name', 'code', 'tld']
-
+
admin.site.register(Country, CountryAdmin)
class RegionBaseAdmin(admin.ModelAdmin):
ordering = ['name_std']
list_display = ['name_std', 'parent', 'code']
search_fields = ['name', 'name_std', 'code']
-
+
class RegionAdmin(RegionBaseAdmin): pass
admin.site.register(Region, RegionAdmin)
class SubregionAdmin(RegionBaseAdmin):
raw_id_fields = ['region']
-
+
admin.site.register(Subregion, SubregionAdmin)
class CityBaseAdmin(admin.ModelAdmin):
ordering = ['name_std']
list_display = ['name_std', 'parent', 'population']
search_fields = ['name', 'name_std']
-
+
class CityAdmin(CityBaseAdmin):
raw_id_fields = Region.levels
-
+
admin.site.register(City, CityAdmin)
class DistrictAdmin(CityBaseAdmin):
raw_id_fields = ['city']
-
+
admin.site.register(District, DistrictAdmin)
class GeoAltNameAdmin(admin.ModelAdmin):
@@ -47,8 +47,7 @@ class GeoAltNameAdmin(admin.ModelAdmin):
class PostalCodeAdmin(admin.ModelAdmin):
ordering = ['code']
- list_display = ['code', 'country', 'region', 'subregion']
- search_fields = ['code', 'country__name', 'region__name', 'subregion__name']
- raw_id_fields = Region.levels
+ list_display = ['code', 'country', 'region_name']
+ search_fields = ['code', 'country__name', 'region_name', 'subregion_name']
admin.site.register(PostalCode, PostalCodeAdmin)

0 comments on commit f035568

Please sign in to comment.