diff options
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | app/blog/admin.py | 11 | ||||
-rw-r--r-- | app/blog/models.py | 4 | ||||
-rw-r--r-- | app/locations/models.py | 16 | ||||
-rw-r--r-- | config/settings/settings.py | 3 | ||||
-rw-r--r-- | config/settings/settings_dev.py | 7 |
6 files changed, 33 insertions, 14 deletions
@@ -23,3 +23,9 @@ What I should do is refactor both into a single clean module with methods for bu # The whole goddamn thing. In build each model has a build function that calls all the routines necessary to build everything. I like that model, but then I need to expose those functions a bit more. + +ToDo: + +build out entry aside model +Add JavaScript to dynamically build asides. maybe. +create css for large image pages light and dark (should just need structural css, dark class name could be enough to work for large image dark pages. diff --git a/app/blog/admin.py b/app/blog/admin.py index c4b7e77..c0d72d9 100644 --- a/app/blog/admin.py +++ b/app/blog/admin.py @@ -3,12 +3,10 @@ from django import forms from blog.models import Entry, PostImage, EntryAside from blog.widgets import AdminImageWidget from django.contrib.gis.admin import OSMGeoAdmin -from django.contrib.gis.maps.google import GoogleMap from django.conf import settings from models import * -GMAP = GoogleMap(key=settings.GOOGLE_MAPS_API_KEY) class EntryAsideInline(admin.TabularInline): model = EntryAside @@ -24,15 +22,8 @@ class BlogEntryForm(forms.ModelForm): widgets = { 'body_markdown': forms.Textarea(attrs={'rows':50, 'cols':100}), } - def clean_point(self): - try: - location = Location.objects.filter(geometry__contains=self.cleaned_data['point']).get() - self.location = location - except Location.DoesNotExist: - raise forms.ValidationError("There is no location associated with that point") - return self.cleaned_data['point'] - + class EntryAdmin(OSMGeoAdmin): form = BlogEntryForm inlines = [EntryAsideInline,] diff --git a/app/blog/models.py b/app/blog/models.py index b7c7d87..80ec303 100644 --- a/app/blog/models.py +++ b/app/blog/models.py @@ -116,6 +116,10 @@ class Entry(models.Model): md = image_url_replace(self.body_markdown) self.body_html = markdown.markdown(md, extensions=['extra',], safe_mode = False) self.dek == markdown.markdown(self.dek, safe_mode = False) + try: + self.location = Location.objects.filter(geometry__contains=self.point).get() + except Location.DoesNotExist: + raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" %(settings.BASE_URL)) super(Entry, self).save() class EntryAside(models.Model): diff --git a/app/locations/models.py b/app/locations/models.py index e088697..6fc85cf 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -159,6 +159,22 @@ class Location(models.Model): def __unicode__(self): return self.name +class BirdingLocation(models.Model): + location = models.ForeignKey(Location) + name = models.CharField(max_length=50) + slug = models.SlugField() + date_visited = models.DateTimeField('Date visited',null=True) + point = models.PointField() + # GeoManager, a subclass that adds a rich set of geospatial queryset methods + objects = models.GeoManager() + + def get_absolute_url(self): + return "/birdinglocations/%s/%s/%s/" % (self.state.country.slug, self.state.slug, self.slug) + + + def __unicode__(self): return self.name + + class Route(models.Model): name = models.CharField(max_length=200) slug = models.SlugField() diff --git a/config/settings/settings.py b/config/settings/settings.py index 47b5562..13bcb5e 100644 --- a/config/settings/settings.py +++ b/config/settings/settings.py @@ -37,7 +37,8 @@ GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29 # API key for Flickr imports FLICKR_API_KEY = '7b9d978a440c6ab65a545adc0aa0d693' FLICKR_USER_ID = '85322932@N00' - +#root url +BASE_URL = "http://luxagraf.net/" #path to the folder that holds the generated html files FLATFILES_ROOT = os.path.join(PROJ_ROOT, 'site/') #media and image URLs for the generated html files diff --git a/config/settings/settings_dev.py b/config/settings/settings_dev.py index 010ac31..bb7c21b 100644 --- a/config/settings/settings_dev.py +++ b/config/settings/settings_dev.py @@ -29,7 +29,7 @@ SITE_URL = 'http://luxagraf.net/' GRAPPELLI_ADMIN_TITLE = 'Luxagraf Admin' USE_I18N = False USE_L10N = True -USE_TZ = True +USE_TZ = False #API key for Google Maps in Admin MAP_API = "google" @@ -39,6 +39,7 @@ GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29 FLICKR_API_KEY = '7b9d978a440c6ab65a545adc0aa0d693' FLICKR_USER_ID = '85322932@N00' +BASE_URL = "http://127.0.0.1:8000/" #path to the folder that holds the generated html files FLATFILES_ROOT = os.path.join(PROJ_ROOT, 'site/') #media and image URLs for the generated html files @@ -142,8 +143,8 @@ INSTALLED_APPS = ( 'templatetags', 'projects', 'guide', - 'pages' - + 'pages', + 'birds' ) DEVELOPMENT = True if DEVELOPMENT: |