]> git.sommitrealweird.co.uk Git - sommitrealweird.git/commitdiff
Changes for django 2.2 master
authorBrett Parker <idunno@sommitrealweird.co.uk>
Fri, 6 Aug 2021 08:09:29 +0000 (08:09 +0000)
committerBrett Parker <idunno@sommitrealweird.co.uk>
Fri, 6 Aug 2021 08:09:29 +0000 (08:09 +0000)
sommitrealweird/blog/views.py
sommitrealweird/bpcms/models.py
sommitrealweird/bpcms/views.py
sommitrealweird/photo/models.py
sommitrealweird/settings.py

index 52fab007886f526b770234b5e2897b64ed4d0bdc..1f29f984b84419df9e79381e191b56491522cd9f 100644 (file)
@@ -36,6 +36,7 @@ def blog_index(request, section=None):
         except:
             raise Http404
     else:
         except:
             raise Http404
     else:
+        return render(request, 'blog/blog_index.html')
         raise Http404
 
 def blog_view(request, year=None, month=None, day=None, hour=None, minutes=None, section=None, slug=None):
         raise Http404
 
 def blog_view(request, year=None, month=None, day=None, hour=None, minutes=None, section=None, slug=None):
index 5df5a437bff6a78d08f27beb03dfec717f621337..5c49f49b91f4f6b706af653d7def5c480fb2cda6 100644 (file)
@@ -2,7 +2,7 @@ from django.db import models
 from django.conf import settings
 from django.contrib import admin
 from django.core.cache import cache
 from django.conf import settings
 from django.contrib import admin
 from django.core.cache import cache
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 FORMAT_CHOICES = (
         ('rst', 'reStructuredText'),
 
 FORMAT_CHOICES = (
         ('rst', 'reStructuredText'),
@@ -24,7 +24,7 @@ class Document(models.Model):
     title = models.CharField(max_length=150)
     islive = models.BooleanField(default=False)
     extracss = models.ManyToManyField(CSSDocument, blank=True)
     title = models.CharField(max_length=150)
     islive = models.BooleanField(default=False)
     extracss = models.ManyToManyField(CSSDocument, blank=True)
-    folder = models.ForeignKey('Folder', null=True, blank=True)
+    folder = models.ForeignKey('Folder', on_delete=models.SET_NULL, null=True, blank=True)
     format = models.CharField(max_length=10, choices=FORMAT_CHOICES)
     slug = models.SlugField()
     content = models.TextField()
     format = models.CharField(max_length=10, choices=FORMAT_CHOICES)
     slug = models.SlugField()
     content = models.TextField()
@@ -78,7 +78,7 @@ class Document(models.Model):
 class Folder(models.Model):
     title = models.CharField(max_length=150)
     slug = models.SlugField()
 class Folder(models.Model):
     title = models.CharField(max_length=150)
     slug = models.SlugField()
-    parent = models.ForeignKey('self', null=True, blank=True)
+    parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True)
 
     def __str__(self):
         return self.__unicode__()
 
     def __str__(self):
         return self.__unicode__()
index 365174305a6bf0ded27a901a499300f2d2a32906..e0087c86ad5aa26a4eb14f4a959bb0428aaaab63 100644 (file)
@@ -2,6 +2,7 @@ from bpcms.models import CSSDocument, Document, Folder
 from django.http import Http404, HttpResponse
 from django.shortcuts import render
 from django.template import RequestContext, loader
 from django.http import Http404, HttpResponse
 from django.shortcuts import render
 from django.template import RequestContext, loader
+import sys
 
 def document_view(request, slug=None, folders=None):
     if folders == None and slug == None:
 
 def document_view(request, slug=None, folders=None):
     if folders == None and slug == None:
@@ -28,7 +29,7 @@ def document_view(request, slug=None, folders=None):
 
     if folder != None:
         try:
 
     if folder != None:
         try:
-            if not request.user.is_authenticated():
+            if not request.user.is_authenticated:
                 doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__exact=folder)
             else:
 
                 doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__exact=folder)
             else:
 
@@ -44,11 +45,12 @@ def document_view(request, slug=None, folders=None):
                 raise Http404
     else:
         try:
                 raise Http404
     else:
         try:
-            if not request.user.is_authenticated():
+            if not request.user.is_authenticated:
                 doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__isnull=True)
             else:
                 doc = Document.objects.get(slug__exact=slug, folder__isnull=True)
         except:
                 doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__isnull=True)
             else:
                 doc = Document.objects.get(slug__exact=slug, folder__isnull=True)
         except:
+            sys.stderr.write("Unexpected error:", sys.exc_info()[0])
             try:
                 folder = Folder.objects.get(slug__exact=slug, parent__isnull=True)
                 if not request.user.is_authenticated():
             try:
                 folder = Folder.objects.get(slug__exact=slug, parent__isnull=True)
                 if not request.user.is_authenticated():
index 3a5d123c8e5b134de54185093c7df7e92c28a5fd..31751c3b262efdef8e729ac307f20f215f89b823 100644 (file)
@@ -26,7 +26,7 @@ class Photo(models.Model):
     image = models.ImageField(upload_to=get_upload_path, null=True)
     caption = models.TextField(blank=True, null=True)
     order = models.IntegerField(blank=True, null=True)
     image = models.ImageField(upload_to=get_upload_path, null=True)
     caption = models.TextField(blank=True, null=True)
     order = models.IntegerField(blank=True, null=True)
-    album = models.ForeignKey('Album')
+    album = models.ForeignKey('Album', on_delete=models.CASCADE)
 
     def __unicode__(self):
         return "%s" %(self.image)
 
     def __unicode__(self):
         return "%s" %(self.image)
index 67b8f32b369f57abdd147862443ae3edb8ac4e88..6eb539f2723bcc04c962b62c984cecbd68bbab75 100644 (file)
@@ -14,6 +14,7 @@ ADMINS = (
 ALLOWED_HOSTS = [
     "www.sommitrealweird.co.uk",
     "www.sommitrealweird.co.uk.",
 ALLOWED_HOSTS = [
     "www.sommitrealweird.co.uk",
     "www.sommitrealweird.co.uk.",
+    "10.0.3.191",
 ]
 
 MANAGERS = ADMINS
 ]
 
 MANAGERS = ADMINS
@@ -55,7 +56,7 @@ CACHES = {
     }
 }
 
     }
 }
 
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -96,6 +97,7 @@ INSTALLED_APPS = (
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',
+    'django.contrib.messages',
     'bpcms',
     'generic',
     'blog',
     'bpcms',
     'generic',
     'blog',