summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/blog/models.py3
-rw-r--r--app/blog/signals.py21
-rw-r--r--app/build/models.py156
-rw-r--r--app/builder/__init__.py (renamed from app/build/__init__.py)0
-rw-r--r--app/builder/admin.py (renamed from app/build/admin.py)0
-rw-r--r--app/builder/base.py (renamed from app/build/base.py)0
-rw-r--r--app/builder/views.py74
-rw-r--r--config/base_urls.py2
-rw-r--r--config/settings/settings.py1
9 files changed, 75 insertions, 182 deletions
diff --git a/app/blog/models.py b/app/blog/models.py
index 4ee446e..8e7a513 100644
--- a/app/blog/models.py
+++ b/app/blog/models.py
@@ -10,8 +10,6 @@ from utils import markdown2 as markdown
from photos.models import PhotoGallery
from locations.models import Location,Region
-#from locations.signals import create_location_item
-from blog.signals import update_recent
def get_upload_path(self, filename):
return "images/post-images/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename)
@@ -176,5 +174,4 @@ class LatestFull(Feed):
from django.dispatch import dispatcher
from django.db.models import signals
-signals.post_save.connect(update_recent, sender=Entry)
diff --git a/app/blog/signals.py b/app/blog/signals.py
deleted file mode 100644
index a8c0556..0000000
--- a/app/blog/signals.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from django.template.loader import render_to_string
-from django.conf import settings
-from django.template import Context
-from django.db.models import get_model
-from django.conf import settings
-
-from locations.models import Region,Country,Route
-
-from build.base import BuildWriting,BuildMap
-
-def update_recent(sender, instance, signal, *args, **kwargs):
- if not settings.DEVELOPMENT:
- if instance.status == 1:
- #update homepage, archives and details
- b = BuildWriting()
- b.build_homepage()
- b.build_archive_pages()
- b.build_detail_pages()
- #update map
- b = BuildMap()
- b.build() \ No newline at end of file
diff --git a/app/build/models.py b/app/build/models.py
deleted file mode 100644
index 65c0149..0000000
--- a/app/build/models.py
+++ /dev/null
@@ -1,156 +0,0 @@
-import datetime
-from django.contrib.gis.db import models
-from django.conf import settings
-from django.contrib.syndication.feeds import Feed
-from django.contrib.sitemaps import Sitemap
-from django.template.defaultfilters import truncatewords_html
-
-
-from utils import markdown2 as markdown
-
-from photos.models import PhotoGallery
-from locations.models import Location,Region
-#from locations.signals import create_location_item
-from blog.signals import update_recent
-
-def get_upload_path(self, filename):
- return "images/post-images/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename)
-
-def get_tn_path(self, filename):
- return "images/post-thumbnail/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename)
-
-
-def markdown_processor(md):
- processed = markdown.markdown(md, ['footnotes'],safe_mode = False).split('<break>')
- html = processed[0]+processed[1]
- lede = processed[0]
- return html, lede
-
-PUB_STATUS = (
- (0, 'Draft'),
- (1, 'Published'),
- )
-
-TEMPLATES = (
- (0, 'single'),
- (1, 'double'),
- (2, 'single-dark'),
- (3, 'double-dark'),
- )
-class PostImage(models.Model):
- title = models.CharField(max_length=100)
- image = models.ImageField(upload_to="%s%s" %(settings.IMAGES_ROOT, datetime.datetime.today().strftime("%Y")))
-
- def __unicode__(self):
- return self.title
-
- def output_tags(self):
- return force_unicode('<img src="%s%s" alt="%s" class="postpic"/>' % \
- (settings.IMAGES_URL, self.image.url.split('images')[1].split('/',1)[1], self.title))
-
-
-class Topic(models.Model):
- name = models.CharField(max_length=100)
- slug = models.SlugField()
-
- def __unicode__(self):
- return self.name
-
- def get_absolute_url(self):
- return "/topics/%s/" % (self.slug)
-
-class Entry(models.Model):
- title = models.CharField(max_length=200)
- slug = models.SlugField(unique_for_date='pub_date')
- lede = models.TextField(blank=True)
- body_html = models.TextField(blank=True)
- body_markdown = models.TextField()
- dek = models.TextField(null=True,blank=True)
- pub_date = models.DateTimeField('Date published')
- enable_comments = models.BooleanField(default=True)
- point = models.PointField(null=True)
- location = models.ForeignKey(Location, null=True)
- region = models.ForeignKey(Region, null=True)
- status = models.IntegerField(choices=PUB_STATUS, default=0)
- photo_gallery = models.ForeignKey(PhotoGallery, blank=True, null=True, verbose_name='photo set')
- image = models.FileField(upload_to=get_upload_path, null=True,blank=True)
- thumbnail = models.FileField(upload_to=get_tn_path, null=True,blank=True)
- meta_description = models.CharField(max_length=256, null=True, blank=True)
- topics = models.ManyToManyField(Topic, blank=True)
- template_name = models.IntegerField(choices=TEMPLATES, default=0)
-
- @property
- def longitude(self):
- '''Get the site's longitude.'''
- return self.point.x
-
- @property
- def latitude(self):
- '''Get the site's latitude.'''
- return self.point.y
-
- class Meta:
- ordering = ('-pub_date',)
- get_latest_by = 'pub_date'
- verbose_name_plural = 'entries'
-
- def __unicode__(self):
- return self.title
-
- def get_absolute_url(self):
- return "/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug)
-
- def get_previous_published(self):
- return self.get_previous_by_pub_date(status__exact=1)
-
- def get_next_published(self):
- return self.get_next_by_pub_date(status__exact=1)
-
-
- def comment_period_open(self):
- return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date
-
- def get_thumbnail_url(self):
- if settings.DEVELOPMENT == True:
- return '%s%s' %(settings.IMAGES_URL, self.thumbnail.url[35:])
- else:
- return '%s%s' %(settings.IMAGES_URL, self.thumbnail.url[33:])
-
- def get_image_url(self):
- if settings.DEVELOPMENT == True:
- return '%s%s' %(settings.IMAGES_URL, self.image.url[35:])
- else:
- return '%s%s' %(settings.IMAGES_URL, self.image.url[33:])
-
- def save(self):
- html,lede = markdown_processor(self.body_markdown)
- self.body_html = html
- self.lede = lede
- self.dek == markdown.markdown(self.dek, safe_mode = False)
- super(Entry, self).save()
-
-class BlogSitemap(Sitemap):
- changefreq = "never"
- priority = 1.0
-
- def items(self):
- return Entry.objects.filter(status=1)
-
- def lastmod(self, obj):
- return obj.pub_date
-
-class LatestFull(Feed):
- title = "Luxagraf: Topographical Writings"
- link = "/writing/"
- description = "Latest postings to luxagraf.net"
- description_template = 'feeds/blog_description.html'
-
- def items(self):
- return Entry.objects.filter(status__exact=1).order_by('-pub_date')[:10]
-
-
-from django.dispatch import dispatcher
-from django.db.models import signals
-
-signals.post_save.connect(update_recent, sender=Entry)
-
diff --git a/app/build/__init__.py b/app/builder/__init__.py
index e69de29..e69de29 100644
--- a/app/build/__init__.py
+++ b/app/builder/__init__.py
diff --git a/app/build/admin.py b/app/builder/admin.py
index ee6957e..ee6957e 100644
--- a/app/build/admin.py
+++ b/app/builder/admin.py
diff --git a/app/build/base.py b/app/builder/base.py
index 49f1989..49f1989 100644
--- a/app/build/base.py
+++ b/app/builder/base.py
diff --git a/app/builder/views.py b/app/builder/views.py
new file mode 100644
index 0000000..0dee430
--- /dev/null
+++ b/app/builder/views.py
@@ -0,0 +1,74 @@
+from django.http import HttpResponseRedirect
+from django.core.urlresolvers import reverse
+from django.shortcuts import render_to_response,get_object_or_404,redirect
+
+from django.template import RequestContext
+
+from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPages, BuildPhotos,BuildAbout,BuildProjects,BuildSitemap,BuildContact
+def do_build(request):
+ section = request.GET.get('id', '')
+ if section != '':
+
+ #build writing archives
+ if section == 'writing':
+ BuildWriting().build()
+ context = {'message': 'Writing Posts to Disk',}
+
+ #build photo galleries
+ elif section == 'photos':
+ BuildPhotos().build()
+ context = {'message': 'Writing Photo Galleries to Disk',}
+
+ #build project pages
+ elif section == 'projects':
+ BuildProjects().build()
+ context = {'message': 'Writing Project pages to Disk',}
+
+ #build pages
+ elif section == 'pages':
+ BuildPages().build()
+ context = {'message': 'Writing Pages to Disk',}
+
+ #build map
+ elif section == 'map':
+ BuildMap().build()
+ context = {'message': 'Writing Map to Disk',}
+
+ #build Writing RSS Feed
+ elif section == 'feed':
+ BuildWritingFeed().build()
+ context = {'message': 'Writing RSS Feed to Disk',}
+
+ #build Sitemap
+ elif section == 'sitemap':
+ BuildSitemap().build()
+ context = {'message': 'Writing Sitemap to Disk',}
+
+ """
+ elif section == 'all':
+ g.build_entire_site()
+ context = {'message': 'Writing Entire Site to disk',}
+ elif section == 'newpost':
+ g.create_new_post()
+ #build writing archives
+ #BuildWriting().build()
+ #build map
+ #build homepage
+ #build feed
+ #build sitemap
+ context = {'message': 'Publishing New Post',}
+
+ elif section == 'home':
+ g.create_homepage()
+ context = {'message': 'Writing Homepage to Disk',}
+
+ """
+
+ else:
+ context = {}
+ #return redirect('/admin/', message='test')
+ return render_to_response('admin/message.html', context, context_instance = RequestContext(request))
+ #return HttpResponseRedirect(reverse('admin:index'))
+
+
+
diff --git a/config/base_urls.py b/config/base_urls.py
index 91ab63d..b2cd642 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -43,7 +43,7 @@ urlpatterns += patterns('',
urlpatterns += patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
#(r'^admin/filebrowser/', include('filebrowser.urls')),
- (r'^admin/build/.*', 'static_generator.views.do_build'),
+ (r'^admin/build/.*', 'builder.views.do_build'),
(r'^admin/', include(admin.site.urls),),
(r'^grappelli/', include('grappelli.urls')),
#(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
diff --git a/config/settings/settings.py b/config/settings/settings.py
index 8b71e3c..efd7e74 100644
--- a/config/settings/settings.py
+++ b/config/settings/settings.py
@@ -144,7 +144,6 @@ INSTALLED_APPS = (
'templatetags',
'projects',
'guide',
- 'static_generator',
'pages'
)