I am very new to Geodjango and have been running into some issues with a web mapping application. Currently, I am trying to make it so I can view all the schools on a map at once, as well as view individual schools on a map. I have been able to make it so I can view individual schools, but I am still unable to view all schools on a map at once.
This is how it looks when I am able to view a single school:
Here is what happens when I try to view all schools at once:
Am I going to the wrong url to do so or is there some other issue in the code that I am not seeing?
Here are my scripts:
from django.conf.urls import url, include from django.contrib import admin from django.urls import include, path ... urlpatterns = [ url(r'^schools/', include('schools.urls')), path('admin/', admin.site.urls), ]
from django.db import models from django.contrib.gis.db import models as geomodels ... class School(models.Model): name = models.CharField(max_length=300, blank=False) geometry = geomodels.PointField() ... class Meta: order = ('name',)
from django.apps import AppConfig ... class SchoolsConfig(AppConfig): name = 'schools'
from django.contrib import admin from .models import School from leaflet.admin import LeafletGeoAdmin ... class SchoolAdmin(LeafletGeoAdmin): list_display = ('name', 'geometry') ... admin.site.register(School, SchoolAdmin)
from django.conf.urls import url from . import views ... app_name = 'schools' ... urlpatterns = [ url(r^school/(?P<pk>[0-9]+)$', views.SchoolsDetailView.as_view(), name='school-detail'), ]
from django.views.generic import DetailView from .models import School ... class SchoolsDetailView(DetailView): """ School detail view. """ template_name = r"C:\Users\Drew\Desktop\djangoproject\schools_project\templates\school-detail" model = School
Does anybody have any ideas or tips on how I can view all points on a map at the same time?