-from models import BlogEntry, BlogSection
+from blog.models import BlogEntry, BlogSection
from django.contrib import admin
class BlogEntryAdmin(admin.ModelAdmin):
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.22 on 2019-07-23 16:12
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='blogentry',
+ name='format',
+ field=models.CharField(choices=[('rst', 'reStructuredText'), ('html', 'HTML')], max_length=10),
+ ),
+ ]
-from models import CSSDocument, Document, Folder
+from bpcms.models import CSSDocument, Document, Folder
from django.contrib import admin
class CSSDocumentAdmin(admin.ModelAdmin):
pass
menu_items.sort( \
- cmp=lambda x,y: cmp(x['title'].lower(), y['title'].lower()))
+ key=lambda x: x['title'].lower())
cache.set('bpcms_mainmenu', menu_items, 3600)
return {
)
menu_items.sort( \
- cmp=lambda x,y: cmp(x['title'].lower(), y['title'].lower()))
+ key=lambda x: x['title'].lower())
cache.set('bpcms_contentmenu_%s' %("/".join(folderpath)), menu_items)
--- /dev/null
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.22 on 2019-07-23 16:12
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('bpcms', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='document',
+ name='extracss',
+ field=models.ManyToManyField(blank=True, to='bpcms.CSSDocument'),
+ ),
+ migrations.AlterField(
+ model_name='document',
+ name='format',
+ field=models.CharField(choices=[('rst', 'reStructuredText'), ('html', 'HTML')], max_length=10),
+ ),
+ ]
class Document(models.Model):
title = models.CharField(max_length=150)
islive = models.BooleanField(default=False)
- extracss = models.ManyToManyField(CSSDocument, null=True, blank=True)
+ extracss = models.ManyToManyField(CSSDocument, blank=True)
folder = models.ForeignKey('Folder', null=True, blank=True)
format = models.CharField(max_length=10, choices=FORMAT_CHOICES)
slug = models.SlugField()
newimg.save("%sw%d/%s" %(thumbs_dir, width, imagefile))
return "%s%s/w%d/%s" %(settings.MEDIA_URL, thumbsdirectory, width, imagefile)
- except Exception, e:
+ except Exception as e:
sys.stderr.write("Got exception: %s" %(e,))
elif height != None:
from django import template
from django.conf import settings
-from django.utils.encoding import smart_str, force_unicode
+from django.utils.encoding import smart_bytes, force_text
from django.utils.safestring import mark_safe
from generic import docutils_xhtml11
from docutils.core import publish_parts
except ImportError:
if settings.DEBUG:
- raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
- return force_unicode(value)
+ raise template.TemplateSyntaxError("Error in {% restructuredtext %} filter: The Python docutils library isn't installed.")
+ return force_text(value)
else:
docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
- parts = publish_parts(source=smart_str(value), writer=docutils_xhtml11.Writer(), settings_overrides=docutils_settings)
- return mark_safe(force_unicode(parts["fragment"]))
+ parts = publish_parts(source=smart_bytes(value), writer=docutils_xhtml11.Writer(), settings_overrides=docutils_settings)
+ return mark_safe(force_text(parts["fragment"]))
restructuredtext.is_safe = True
register.filter(restructuredtext)
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import sys
-from models import Album, Photo
+from photo.models import Album, Photo
from django.contrib import admin
class AlbumAdmin(admin.ModelAdmin):
from django.conf import settings
-from models import Album, Photo
+from photo.models import Album, Photo
import re
def content_breadcrumb(request):
from django.conf.urls import url
-from models import Album
-from views import AlbumListView, PhotoListView, PhotoView
+from photo.models import Album
+from photo.views import AlbumListView, PhotoListView, PhotoView
urlpatterns = [
url(r'^$', AlbumListView.as_view()),
from django.views.generic import ListView, DetailView
from django.http import Http404
-from models import Album, Photo
+from photo.models import Album, Photo
class AlbumListView(ListView):
model = Album
MEDIA_ROOT = os.path.join(topdir, 'media') + os.sep
MEDIA_URL = '/media/'
+STATIC_ROOT = '/usr/lib/python3/dist-packages/django/contrib/admin/static/'
STATIC_URL = '/static/'
import random
import string
-key_chars = "%s%s%s" % (string.letters, string.digits, '+-()_#~')
+key_chars = "%s%s%s" % (string.ascii_letters, string.digits, '+-()_#~')
SECRET_KEY = [random.choice(key_chars) for a in range(0,50)]
CACHES = {
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
from django.conf.urls.static import static
import bpcms.views
import django.views.static
-from settings import MEDIA_ROOT, MEDIA_URL, STATIC_URL
+from settings import MEDIA_ROOT, MEDIA_URL, STATIC_ROOT, STATIC_URL
from blog.feeds import LatestBlogEntries, LatestBlogEntriesRss
from django.contrib import admin
# 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'^admin/', include(admin.site.urls)),
+ url(r'^static/(?P<path>.*)$', django.views.static.serve, {'document_root': STATIC_ROOT, 'show_indexes': True}),
+ url(r'^admin/', admin.site.urls),
url(r'^blog/', include('blog.urls')),
url(r'^photo/', include('photo.urls')),
#url(r'^photos/', include('photo.urls')),
url(r'^feeds/rss/blog/', LatestBlogEntriesRss()),
url(r'^feeds/blog/', LatestBlogEntries()),
url(r'^', include('bpcms.urls'))
-] + static(STATIC_URL, document_root=MEDIA_ROOT)
+]
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>{% block title %}{{ title }}{% endblock %}</title>
- <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}style/main.css" />
+ {% load static %}
+ <link rel="stylesheet" type="text/css" href="{% get_media_prefix %}style/main.css" />
{% block extrahead %}{% endblock %}
</head>
<body>