Get basic, admin-editable POI working

This commit is contained in:
Anna Sidwell 2018-10-12 18:56:27 -04:00
parent 4dc3acb1f9
commit c21a06d5c8
2 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,7 @@ from django import forms
from dal import autocomplete
from leaflet.admin import LeafletGeoAdmin
from .models import CaseStudy, CaseStudyDraft, SpatialRefSys
from .models import CaseStudy, CaseStudyDraft, SpatialRefSys, PointOfInterest
class CaseStudyDraftAdmin(admin.ModelAdmin):
@ -51,3 +51,4 @@ class CaseStudyAdmin(LeafletGeoAdmin):
admin.site.register(CaseStudy, CaseStudyAdmin)
admin.site.register(SpatialRefSys)
admin.site.register(CaseStudyDraft, CaseStudyDraftAdmin)
admin.site.register(PointOfInterest)

View File

@ -1016,6 +1016,12 @@ class CaseStudy(models.Model):
class PointOfInterest(models.Model):
class Meta:
verbose_name_plural = 'points of interest'
def __str__(self):
return self.title
author = models.ForeignKey(
User,
models.SET_NULL,
@ -1026,7 +1032,7 @@ class PointOfInterest(models.Model):
date_created = models.DateTimeField(auto_now_add=True, null=False)
slug = AutoSlugField(populate_from=['entry_name'], editable=False)
slug = AutoSlugField(populate_from=['title'], editable=False)
approved = models.BooleanField(default=False)