Sfoglia il codice sorgente

Fix: Try to migrate middlware to new version

pull/218/head
winkidney 4 anni fa
parent
commit
7608ef928a
4 ha cambiato i file con 11 aggiunte e 4 eliminazioni
  1. +2
    -2
      core/migrations/0001_initial.py
  2. +1
    -1
      django_images/migrations/0001_initial.py
  3. +4
    -0
      pinry/middleware.py
  4. +4
    -1
      users/middleware.py

+ 2
- 2
core/migrations/0001_initial.py Vedi File

@@ -36,12 +36,12 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='pin',
name='image',
field=models.ForeignKey(related_name='pin', to='core.Image'),
field=models.ForeignKey(related_name='pin', to='core.Image', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='pin',
name='submitter',
field=models.ForeignKey(to='users.User'),
field=models.ForeignKey(to='users.User', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='pin',


+ 1
- 1
django_images/migrations/0001_initial.py Vedi File

@@ -28,7 +28,7 @@ class Migration(migrations.Migration):
('size', models.CharField(max_length=100)),
('height', models.PositiveIntegerField(default=0, editable=False)),
('width', models.PositiveIntegerField(default=0, editable=False)),
('original', models.ForeignKey(to='django_images.Image')),
('original', models.ForeignKey(to='django_images.Image', on_delete=models.CASCADE)),
],
),
migrations.AlterUniqueTogether(


+ 4
- 0
pinry/middleware.py Vedi File

@@ -2,6 +2,10 @@ from django.middleware.csrf import get_token


class ForceCSRFCookieMiddleware:

def __init__(self, get_response):
self.get_response = get_response

def process_request(self, request):
if "CSRF_TOKEN" not in request.META:
get_token(request)


+ 4
- 1
users/middleware.py Vedi File

@@ -2,12 +2,15 @@ from django.conf import settings
from django.http import HttpResponseForbidden


class Public(object):
class Public:

acceptable_paths = (
"/api/v2/profile/",
)

def __init__(self, get_response):
self.get_response = get_response

def process_request(self, request):
if settings.PUBLIC is False and not request.user.is_authenticated():
for path in self.acceptable_paths:


Caricamento…
Annulla
Salva