@@ -36,12 +36,12 @@ class Migration(migrations.Migration): | |||||
migrations.AddField( | migrations.AddField( | ||||
model_name='pin', | model_name='pin', | ||||
name='image', | 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( | migrations.AddField( | ||||
model_name='pin', | model_name='pin', | ||||
name='submitter', | name='submitter', | ||||
field=models.ForeignKey(to='users.User'), | |||||
field=models.ForeignKey(to='users.User', on_delete=models.CASCADE), | |||||
), | ), | ||||
migrations.AddField( | migrations.AddField( | ||||
model_name='pin', | model_name='pin', | ||||
@@ -28,7 +28,7 @@ class Migration(migrations.Migration): | |||||
('size', models.CharField(max_length=100)), | ('size', models.CharField(max_length=100)), | ||||
('height', models.PositiveIntegerField(default=0, editable=False)), | ('height', models.PositiveIntegerField(default=0, editable=False)), | ||||
('width', 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( | migrations.AlterUniqueTogether( | ||||
@@ -2,6 +2,10 @@ from django.middleware.csrf import get_token | |||||
class ForceCSRFCookieMiddleware: | class ForceCSRFCookieMiddleware: | ||||
def __init__(self, get_response): | |||||
self.get_response = get_response | |||||
def process_request(self, request): | def process_request(self, request): | ||||
if "CSRF_TOKEN" not in request.META: | if "CSRF_TOKEN" not in request.META: | ||||
get_token(request) | get_token(request) | ||||
@@ -2,12 +2,15 @@ from django.conf import settings | |||||
from django.http import HttpResponseForbidden | from django.http import HttpResponseForbidden | ||||
class Public(object): | |||||
class Public: | |||||
acceptable_paths = ( | acceptable_paths = ( | ||||
"/api/v2/profile/", | "/api/v2/profile/", | ||||
) | ) | ||||
def __init__(self, get_response): | |||||
self.get_response = get_response | |||||
def process_request(self, request): | def process_request(self, request): | ||||
if settings.PUBLIC is False and not request.user.is_authenticated(): | if settings.PUBLIC is False and not request.user.is_authenticated(): | ||||
for path in self.acceptable_paths: | for path in self.acceptable_paths: | ||||