*.py[oc]
/sommitrealweird.db
/sommitrealweird/localsettings.py
+/media/admin
/media/photos
/media/thumbs
/tmp
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-06-22 09:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='BlogEntry',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=150)),
+ ('islive', models.BooleanField(default=False)),
+ ('format', models.CharField(choices=[(b'rst', b'reStructuredText'), (b'html', b'HTML')], max_length=10)),
+ ('slug', models.SlugField()),
+ ('publish_date', models.DateTimeField()),
+ ('content', models.TextField()),
+ ],
+ options={
+ 'ordering': ['-publish_date'],
+ },
+ ),
+ migrations.CreateModel(
+ name='BlogSection',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=150)),
+ ('slug', models.SlugField()),
+ ],
+ ),
+ migrations.AddField(
+ model_name='blogentry',
+ name='sections',
+ field=models.ManyToManyField(to='blog.BlogSection'),
+ ),
+ ]
-from django.contrib.comments.moderation import CommentModerator, moderator
from django.db import models
from django.conf import settings
from django.contrib import admin
class Meta:
ordering = ['-publish_date']
-class BlogEntryCommentModerator(CommentModerator):
- email_notification = True
-
- def moderate(self, comment, content_object, request):
- if request.user.is_authenticated():
- return False
- else:
- return True
-
-moderator.register(BlogEntry, BlogEntryCommentModerator)
-
class BlogSection(models.Model):
title = models.CharField(max_length=150)
slug = models.SlugField()
{% extends "base.html" %}
{% load xhtml11rst %}
-{% load comments %}
{% block extrahead %}
<link rel="alternate" type="application/atom+xml" title="iDunno's Blog - Atom Feed" href="{{ BLOG_FEED_ROOT }}" />
{% endif %}
{% endif %}
{% endfor %}
- {% get_comment_count for entry as comment_count %}
- | <a href="{{ entry.get_absolute_url }}">permalink</a> | <a href="{{ entry.get_absolute_url }}#comments">Comments</a>: {{ comment_count }}</p>
+ | <a href="{{ entry.get_absolute_url }}">permalink</a></p>
{% endfor %}
{% if paginated and has_more_than_one_page %}
<p class="paginator">Pages:
{% extends "base.html" %}
{% load xhtml11rst %}
-{% load comments %}
{%block title %}{{ entry.title }}{% endblock %}
{% endif %}
{% endfor %}
{% endif %}
- {% get_comment_count for entry as comment_count %}
- | <a href="{{ entry.get_absolute_url }}">permalink</a> | Comments: {{ comment_count }}
+ | <a href="{{ entry.get_absolute_url }}">permalink</a>
</p>
-{% if comment_count %}
- <div class="comments">
- <a name="comments"></a>
- {% get_comment_list for entry as comment_list %}
- {% for comment in comment_list %}
- <div class="comment">
- <h3>{{ comment.user_name }} - {{ comment.submit_date|date:"Y-m-d H:i" }}</h3>
- {{ comment.comment }}
- </div>
- {% endfor %}
- </div>
-{% endif %}
-<div class="comment_new">
- {% render_comment_form for entry %}
-</div>
{% endblock %}
-from django.conf.urls import patterns
+from django.conf.urls import url
+import blog.views
from settings import MEDIA_ROOT, MEDIA_URL
-urlpatterns = patterns('',
- (r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/(?P<slug>[^/]+)(/|)$', 'blog.views.blog_view'),
- (r'^(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})-(?P<slug>[^/]+)\.html$', 'blog.views.blog_view'),
- (r'^(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})(?P<hour>[0-9]{2})(?P<minutes>[0-9]{2})-(?P<slug>[^/]+)\.html$', 'blog.views.blog_view'),
- (r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/$', 'blog.views.blog_view'),
- (r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', 'blog.views.blog_view'),
- (r'^(?P<year>[0-9]{4})/$', 'blog.views.blog_view'),
- (r'^section/(?P<section>[^/]*)/$', 'blog.views.blog_index'),
- (r'^$', 'blog.views.blog_index'),
-)
+urlpatterns = [
+ url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/(?P<slug>[^/]+)(/|)$', blog.views.blog_view),
+ url(r'^(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})-(?P<slug>[^/]+)\.html$', blog.views.blog_view),
+ url(r'^(?P<year>[0-9]{4})(?P<month>[0-9]{2})(?P<day>[0-9]{2})(?P<hour>[0-9]{2})(?P<minutes>[0-9]{2})-(?P<slug>[^/]+)\.html$', blog.views.blog_view),
+ url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/$', blog.views.blog_view),
+ url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', blog.views.blog_view),
+ url(r'^(?P<year>[0-9]{4})/$', blog.views.blog_view),
+ url(r'^section/(?P<section>[^/]*)/$', blog.views.blog_index),
+ url(r'^$', blog.views.blog_index),
+]
from blog.models import BlogEntry, BlogSection
from django.http import Http404, HttpResponse
+from django.shortcuts import render
from django.template import RequestContext, loader
from django.core.paginator import Paginator
from django.conf import settings
try:
paginated_entries = paginator.page(page)
pages = paginator.page_range
- t = loader.get_template("blog/blog_index.html")
- c = RequestContext(request,
- {
+ c = {
"entries": paginated_entries.object_list,
"title": settings.BLOG_TITLE,
"page": page,
"has_prev": paginated_entries.has_previous(),
"next": page + 1,
"prev": page - 1
- })
- return HttpResponse(t.render(c))
+ }
+ return render(request, 'blog/blog_index.html', c)
except:
raise Http404
else:
try:
blog_entry = BlogEntry.objects.get(publish_date__year=year, publish_date__month=month, publish_date__day=day, slug__exact=slug)
template_name = "blog/single_entry_%s.html" %(blog_entry.format,)
- t = loader.get_template(template_name)
- c = RequestContext(request,
- {
+ c = {
"entry": blog_entry,
"publish_date": blog_entry.publish_date
}
- )
- return HttpResponse(t.render(c))
+ return render(request, template_name, c)
except:
raise Http404
else:
try:
paginated_entries = paginator.page(page)
pages = paginator.page_range
- t = loader.get_template("blog/blog_index.html")
- c = RequestContext(request,
- {
+ c = {
"entries": paginated_entries.object_list,
"title": settings.BLOG_TITLE,
"page": page,
"has_prev": paginated_entries.has_previous(),
"next": page + 1,
"prev": page - 1
- })
- return HttpResponse(t.render(c))
+ }
+ return render(request, "blog/blog_index.html", c)
except:
raise Http404
else:
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-06-22 09:39
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='CSSDocument',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=150)),
+ ('slug', models.SlugField()),
+ ('content', models.TextField()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Document',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=150)),
+ ('islive', models.BooleanField(default=False)),
+ ('format', models.CharField(choices=[(b'rst', b'reStructuredText'), (b'html', b'HTML')], max_length=10)),
+ ('slug', models.SlugField()),
+ ('content', models.TextField()),
+ ('extracss', models.ManyToManyField(blank=True, null=True, to='bpcms.CSSDocument')),
+ ],
+ options={
+ 'ordering': ['folder'],
+ },
+ ),
+ migrations.CreateModel(
+ name='Folder',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=150)),
+ ('slug', models.SlugField()),
+ ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='bpcms.Folder')),
+ ],
+ ),
+ migrations.AddField(
+ model_name='document',
+ name='folder',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='bpcms.Folder'),
+ ),
+ ]
def get_absolute_url(self):
if self.slug == 'index':
if self.folder.parent:
- return reverse('bpcms.views.document_view', kwargs={'folders': self.folder.parent.get_path(), 'slug': self.folder.slug})
+ return reverse('bpcms-document-view', kwargs={'folders': self.folder.parent.get_path(), 'slug': self.folder.slug})
else:
- return reverse('bpcms.views.document_view', kwargs={'slug': self.folder.slug})
+ return reverse('bpcms-document-view', kwargs={'slug': self.folder.slug})
else:
if self.folder:
- return reverse('bpcms.views.document_view', kwargs={'folders': self.get_folder_path(), 'slug': self.slug})
+ return reverse('bpcms-document-view', kwargs={'folders': self.get_folder_path(), 'slug': self.slug})
else:
- return reverse('bpcms.views.document_view', kwargs={'slug': self.slug})
+ return reverse('bpcms-document-view', kwargs={'slug': self.slug})
class Folder(models.Model):
title = models.CharField(max_length=150)
def get_absolute_url(self):
if self.parent:
- return reverse('bpcms.views.document_view', kwargs={'folders': self.parent.get_path(), 'slug': self.slug})
+ return reverse('bpcms-document-view', kwargs={'folders': self.parent.get_path(), 'slug': self.slug})
else:
- return reverse('bpcms.views.document_view', kwargs={'slug': self.slug})
+ return reverse('bpcms-document-view', kwargs={'slug': self.slug})
-from django.conf.urls import patterns
+from django.conf.urls import url
+import bpcms.views
-urlpatterns = patterns('',
- (r'^$', 'bpcms.views.document_view', {'slug': 'index'}),
- (r'^css-docs/(?P<slug>[^/]+)$', 'bpcms.views.css_view'),
- (r'^(?P<slug>[^/]+)/$', 'bpcms.views.document_view'),
- (r'^(?P<folders>.*)/(?P<slug>[^/]+)/$', 'bpcms.views.document_view'),
-)
+urlpatterns = [
+ url(r'^$', bpcms.views.document_view, {'slug': 'index'}, name='bpcms-document-view'),
+ url(r'^css-docs/(?P<slug>[^/]+)$', bpcms.views.css_view),
+ url(r'^(?P<slug>[^/]+)/$', bpcms.views.document_view, name='bpcms-document-view'),
+ url(r'^(?P<folders>.*)/(?P<slug>[^/]+)/$', bpcms.views.document_view, name='bpcms-document-view'),
+]
from bpcms.models import CSSDocument, Document, Folder
-from django.http import Http404, HttpResponse
+from django.http import Http404
+from django.shortcuts import render
from django.template import RequestContext, loader
def document_view(request, slug=None, folders=None):
except:
raise Http404
template_name = "bpcms/%s.html" %(doc.format,)
- t = loader.get_template(template_name)
- c = RequestContext(request,
- {
+ c = {
"content" : doc.content,
"title" : doc.title,
"extracss" : doc.extracss.all(),
- })
- return HttpResponse(t.render(c))
+ }
+ return render(request, template_name, c)
def css_view(request, slug):
cssdoc = CSSDocument.objects.get(slug=slug)
raise Http404()
return HttpResponse(cssdoc.content, content_type="text/css")
-
+
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-06-22 09:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+import photo.models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Album',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=120)),
+ ('caption', models.TextField(blank=True, null=True)),
+ ('slug', models.SlugField()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Photo',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('image', models.ImageField(null=True, upload_to=photo.models.get_upload_path)),
+ ('caption', models.TextField(blank=True, null=True)),
+ ('order', models.IntegerField(blank=True, null=True)),
+ ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='photo.Album')),
+ ],
+ ),
+ ]
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
- 'LOCATION': '%s/tmp' %(topdir),
+ 'LOCATION': '%s/tmp' %(topdir),
}
}
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-)
-
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
ROOT_URLCONF = 'urls'
-TEMPLATE_DIRS = (
- os.path.join(topdir, 'templates'),
-)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [os.path.join(topdir, 'templates'),],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.i18n',
+ 'django.template.context_processors.media',
+ 'bpcms.context_processors.content_menu',
+ 'bpcms.context_processors.content_submenu',
+ 'bpcms.context_processors.content_breadcrumb',
+ 'blog.context_processors.content_breadcrumb',
+ 'blog.context_processors.blog_feed',
+ 'photo.context_processors.content_breadcrumb',
+ ],
+ 'debug': True,
+ },
+ },
+]
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
- 'django.contrib.comments',
'bpcms',
'generic',
'blog',
'photo',
)
-TEMPLATE_CONTEXT_PROCESSORS = (
- 'django.contrib.auth.context_processors.auth',
- 'django.core.context_processors.debug',
- 'django.core.context_processors.i18n',
- 'generic.context_processors.media',
- 'bpcms.context_processors.content_menu',
- 'bpcms.context_processors.content_submenu',
- 'bpcms.context_processors.content_breadcrumb',
- 'blog.context_processors.content_breadcrumb',
- 'blog.context_processors.blog_feed',
- 'photo.context_processors.content_breadcrumb',
-)
APPEND_SLASH=False
from django.conf.urls import include, url
from django.conf.urls.static import static
-from settings import MEDIA_ROOT, MEDIA_URL
+import bpcms.views
+import django.views.static
+from settings import MEDIA_ROOT, MEDIA_URL, STATIC_URL
from blog.feeds import LatestBlogEntries, LatestBlogEntriesRss
from django.contrib import admin
# (r'^sommitrealweird/', include('sommitrealweird.foo.urls')),
# Uncomment this for admin:
- url(r'^$', 'bpcms.views.document_view', {'slug': 'index'}),
- url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': MEDIA_ROOT, 'show_indexes': True}),
+ url(r'^$', bpcms.views.document_view, {'slug': 'index'}),
+ url(r'^media/(?P<path>.*)$', django.views.static.serve, {'document_root': MEDIA_ROOT, 'show_indexes': True}),
url(r'^admin/', include(admin.site.urls)),
url(r'^blog/', include('blog.urls')),
url(r'^photo/', include('photo.urls')),
#url(r'^photos/', include('photo.urls')),
- url(r'^css-doc/(?P<slug>.*)$', 'bpcms.views.css_view'),
+ url(r'^css-doc/(?P<slug>.*)$', bpcms.views.css_view),
url(r'^feeds/rss/blog/', LatestBlogEntriesRss()),
url(r'^feeds/blog/', LatestBlogEntries()),
- url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^', include('bpcms.urls'))
-] + static(MEDIA_URL, MEDIA_ROOT)
+] + static(STATIC_URL, document_root=MEDIA_ROOT)