Commits

Gianluca Pacchiella committed 6021c7d

Add the Address model to the admin.

  • Participants
  • Parent commits 07f4bb8

Comments (0)

Files changed (2)

easy_maps/admin.py

 from django.contrib import admin
+from django import forms
+
+from .models import Address
+from .widgets import AddressWithMapWidget
 
 class AddressAdmin(admin.ModelAdmin):
     list_display = ['address', 'computed_address', 'latitude', 'longitude', 'geocode_error']
     list_filter = ['geocode_error']
     search_fields = ['address']
+    class form(forms.ModelForm):
+        class Meta:
+            widgets = {
+                'address': AddressWithMapWidget({'class': 'vTextField'})
+            }
+
+
+admin.site.register(Address, AddressAdmin)

easy_maps_tests/urls.py

 from django.conf.urls.defaults import *
 from django.views.generic.simple import direct_to_template
+from django.contrib import admin
+
+admin.autodiscover()
 
 urlpatterns = patterns('',
     url(r'^$', direct_to_template, {'template': 'index.html'}, 'index'),
+    (r'^admin/', include(admin.site.urls)),
 )