Skip to content

Instantly share code, notes, and snippets.

@craigderington
Created March 8, 2019 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigderington/d13d6b41563eb769a342e2455ed5abda to your computer and use it in GitHub Desktop.
Save craigderington/d13d6b41563eb769a342e2455ed5abda to your computer and use it in GitHub Desktop.
DRF by Example Admin module
from django.contrib import admin
from .models import Location
# Register your models here.
class LocationAdmin(admin.ModelAdmin):
list_display = ['ip_addr', 'region_name', 'country_name', 'time_zone', 'latitude', 'longitude']
search_fields = ['ip_addr', 'region_name', 'latitude', 'longitude']
list_filter = ['region_name', 'time_zone']
class Meta:
ordering = ['region']
admin.site.register(Location, LocationAdmin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment