Skip to content
Snippets Groups Projects
Commit 447213fa authored by Barnabás Czémán's avatar Barnabás Czémán
Browse files

Upgrade to Django 2.0.1 & small improvments, fixes & update dependencies

parent 04b98bc2
No related branches found
No related tags found
No related merge requests found
Django==1.11.5 Django==2.0.1
djangorestframework==3.6.4 djangorestframework==3.7.7
django-social-authsch==0.1 django-social-authsch==0.1
django-solo==1.1.3
-r base.in -r base.in
flake8==3.4.1 flake8==3.4.1
pip-tools==1.9.0 pip-tools==1.9.0
django-extensions==1.9.1 django-extensions==1.9.9
python-language-server==0.13.0
...@@ -7,25 +7,38 @@ ...@@ -7,25 +7,38 @@
certifi==2017.7.27.1 # via requests certifi==2017.7.27.1 # via requests
chardet==3.0.4 # via requests chardet==3.0.4 # via requests
click==6.7 # via pip-tools click==6.7 # via pip-tools
configparser==3.5.0 # via python-language-server
defusedxml==0.5.0 # via python3-openid, social-auth-core defusedxml==0.5.0 # via python3-openid, social-auth-core
django-extensions==1.9.1 django-extensions==1.9.9
django-social-authsch==0.1 django-social-authsch==0.1
django==1.11.5 django-solo==1.1.3
djangorestframework==3.6.4 django==2.0.1
djangorestframework==3.7.7
first==2.0.1 # via pip-tools first==2.0.1 # via pip-tools
flake8==3.4.1 flake8==3.4.1
future==0.16.0 # via python-language-server
idna==2.6 # via requests idna==2.6 # via requests
mccabe==0.6.1 # via flake8 jedi==0.11.1 # via python-language-server
json-rpc==1.10.8 # via python-language-server
mccabe==0.6.1 # via flake8, python-language-server
oauthlib==2.0.6 # via requests-oauthlib, social-auth-core oauthlib==2.0.6 # via requests-oauthlib, social-auth-core
parso==0.1.1 # via jedi
pip-tools==1.9.0 pip-tools==1.9.0
pycodestyle==2.3.1 # via flake8 pluggy==0.6.0 # via python-language-server
pyflakes==1.5.0 # via flake8 pycodestyle==2.3.1 # via flake8, python-language-server
pydocstyle==2.1.1 # via python-language-server
pyflakes==1.5.0 # via flake8, python-language-server
pyjwt==1.5.3 # via social-auth-core pyjwt==1.5.3 # via social-auth-core
python-language-server==0.13.0
python3-openid==3.1.0 # via social-auth-core python3-openid==3.1.0 # via social-auth-core
pytz==2017.2 # via django pytz==2017.2 # via django
requests-oauthlib==0.8.0 # via social-auth-core requests-oauthlib==0.8.0 # via social-auth-core
requests==2.18.4 # via requests-oauthlib, social-auth-core requests==2.18.4 # via requests-oauthlib, social-auth-core
six==1.10.0 # via django-extensions, pip-tools, social-auth-app-django, social-auth-core rope==0.10.7 # via python-language-server
six==1.10.0 # via django-extensions, pip-tools, pydocstyle, social-auth-app-django, social-auth-core
snowballstemmer==1.2.1 # via pydocstyle
social-auth-app-django==2.0.0 # via django-social-authsch social-auth-app-django==2.0.0 # via django-social-authsch
social-auth-core==1.5.0 # via django-social-authsch, social-auth-app-django social-auth-core==1.5.0 # via django-social-authsch, social-auth-app-django
typing==3.6.4 # via django-extensions
urllib3==1.22 # via requests urllib3==1.22 # via requests
yapf==0.20.1 # via python-language-server
-r base.in
gunicorn==19.7.1
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file production.txt production.in
#
certifi==2018.1.18 # via requests
chardet==3.0.4 # via requests
defusedxml==0.5.0 # via python3-openid, social-auth-core
django-social-authsch==0.1
django-solo==1.1.3
django==2.0.1
djangorestframework==3.7.7
gunicorn==19.7.1
idna==2.6 # via requests
oauthlib==2.0.6 # via requests-oauthlib, social-auth-core
pyjwt==1.5.3 # via social-auth-core
python3-openid==3.1.0 # via social-auth-core
pytz==2017.3 # via django
requests-oauthlib==0.8.0 # via social-auth-core
requests==2.18.4 # via requests-oauthlib, social-auth-core
six==1.11.0 # via social-auth-app-django, social-auth-core
social-auth-app-django==2.1.0 # via django-social-authsch
social-auth-core==1.6.0 # via django-social-authsch, social-auth-app-django
urllib3==1.22 # via requests
# Generated by Django 2.0.1 on 2018-01-26 00:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homework', '0004_auto_20180125_1817'),
]
operations = [
migrations.AlterField(
model_name='task',
name='created_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL),
),
]
...@@ -21,11 +21,11 @@ def validate_deadline(date): ...@@ -21,11 +21,11 @@ def validate_deadline(date):
# raise ValidationError(_('Please keep filesize under' + __MAX_UPLOAD_SIZE)) # raise ValidationError(_('Please keep filesize under' + __MAX_UPLOAD_SIZE))
class Task(models.Model): class Task(models.Model):
title = models.CharField(max_length=150, ) title = models.CharField(max_length=150)
date = models.DateTimeField(auto_now_add=True, editable=False, ) date = models.DateTimeField(auto_now_add=True, editable=False)
deadline = models.DateTimeField(validators=[validate_deadline], ) deadline = models.DateTimeField(validators=[validate_deadline])
text = models.TextField() text = models.TextField()
created_by = models.ForeignKey(User, ) created_by = models.ForeignKey(User, on_delete=models.DO_NOTHING)
files = models.FileField( files = models.FileField(
validators=[validators.FileExtensionValidator( validators=[validators.FileExtensionValidator(
'image/png', 'image/png',
...@@ -48,11 +48,11 @@ class Task(models.Model): ...@@ -48,11 +48,11 @@ class Task(models.Model):
class Solution(models.Model): class Solution(models.Model):
task = models.ForeignKey(Task, related_name='task_solution', on_delete=models.CASCADE, ) task = models.ForeignKey(Task, related_name='task_solution', on_delete=models.CASCADE)
# student = models.ForeignKey(account.models.Profile, related_name='student_solution', on_delete=models.CASCADE) # student = models.ForeignKey(account.models.Profile, related_name='student_solution', on_delete=models.CASCADE)
date = models.DateTimeField(auto_now_add=True, editable=False, ) date = models.DateTimeField(auto_now_add=True, editable=False)
ready = models.BooleanField(default=False, ) # if(Soulution.date <= Task.deadline) ready = models.BooleanField(default=False) # if(Soulution.date <= Task.deadline)
accepted = models.BooleanField(default=False, ) accepted = models.BooleanField(default=False)
files = models.FileField( files = models.FileField(
validators=[validators.FileExtensionValidator( validators=[validators.FileExtensionValidator(
'image/png', 'image/png',
...@@ -61,7 +61,7 @@ class Solution(models.Model): ...@@ -61,7 +61,7 @@ class Solution(models.Model):
)], )],
blank=True, blank=True,
) )
created_by = models.ForeignKey(User, ) created_by = models.ForeignKey(User, on_delete=models.CASCADE)
# files = myfields.RestrictedFileField( # files = myfields.RestrictedFileField(
# content_types=['image/png', 'image/jpeg', 'application/zip'], # content_types=['image/png', 'image/jpeg', 'application/zip'],
# max_upload_size=MAX_UPLOAD_SIZE, # max_upload_size=MAX_UPLOAD_SIZE,
......
...@@ -8,11 +8,7 @@ class IsStaffOrReadOnly(BasePermission): ...@@ -8,11 +8,7 @@ class IsStaffOrReadOnly(BasePermission):
""" """
def has_permission(self, request, view): def has_permission(self, request, view):
return ( return request.method in SAFE_METHODS or request.user and request.user.is_staff
request.method in SAFE_METHODS or
request.user and
request.user.is_staff
)
class IsAuthenticatedOrReadOnly(BasePermission): class IsAuthenticatedOrReadOnly(BasePermission):
...@@ -21,11 +17,7 @@ class IsAuthenticatedOrReadOnly(BasePermission): ...@@ -21,11 +17,7 @@ class IsAuthenticatedOrReadOnly(BasePermission):
""" """
def has_permission(self, request, view): def has_permission(self, request, view):
return ( return request.method in SAFE_METHODS or request.user and request.user.is_authenticated
request.method in SAFE_METHODS or
request.user and
request.user.is_authenticated
)
class IsStaffOrReadOnlyForAuthenticated(BasePermission): class IsStaffOrReadOnlyForAuthenticated(BasePermission):
...@@ -34,8 +26,4 @@ class IsStaffOrReadOnlyForAuthenticated(BasePermission): ...@@ -34,8 +26,4 @@ class IsStaffOrReadOnlyForAuthenticated(BasePermission):
The request is authenticated as a staff, or is a read-only request for authenticated. The request is authenticated as a staff, or is a read-only request for authenticated.
""" """
def has_permission(self, request, view): def has_permission(self, request, view):
return ( return request.user.is_staff or request.method in SAFE_METHODS and request.user.is_authenticated
request.user.is_staff or
request.method in SAFE_METHODS and
request.user.is_authenticated
)
# Generated by Django 2.0.1 on 2018-01-26 00:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('news', '0002_auto_20171220_1852'),
]
operations = [
migrations.RenameField(
model_name='article',
old_name='date',
new_name='created_at',
),
migrations.AddField(
model_name='article',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name='article',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='author', to='account.Profile'),
),
]
...@@ -3,10 +3,11 @@ from account.models import Profile ...@@ -3,10 +3,11 @@ from account.models import Profile
class Article(models.Model): class Article(models.Model):
author = models.ForeignKey(Profile, related_name="author") author = models.ForeignKey(Profile, related_name="author", on_delete=models.DO_NOTHING)
title = models.CharField(null=False, max_length=200) title = models.CharField(null=False, max_length=200)
text = models.TextField() text = models.TextField()
date = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
def __str__(self): def __str__(self):
return self.title return self.title
...@@ -3,9 +3,5 @@ from rest_framework.permissions import SAFE_METHODS ...@@ -3,9 +3,5 @@ from rest_framework.permissions import SAFE_METHODS
class IsStaffOrReadOnlyForAuthenticated(BasePermission): class IsStaffOrReadOnlyForAuthenticated(BasePermission):
def has_permission(self, request, view): def has_permission(self, request, view):
return (request.user.is_staff or return request.user.is_staff or request.method in SAFE_METHODS and request.user.is_authenticated
request.method in SAFE_METHODS and
request.user.is_authenticated
)
...@@ -5,4 +5,4 @@ from rest_framework import serializers ...@@ -5,4 +5,4 @@ from rest_framework import serializers
class ArticleListSerializer(serializers.ModelSerializer): class ArticleListSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Article model = Article
fields = '__all__' fields = serializers.ALL_FIELDS
...@@ -2,8 +2,7 @@ from rest_framework import routers ...@@ -2,8 +2,7 @@ from rest_framework import routers
from news import views from news import views
router = routers.DefaultRouter(trailing_slash=False) router = routers.DefaultRouter()
router.register(r'news', views.NewsViewSet) router.register(r'news', views.NewsViewSet)
urlpatterns = router.urls urlpatterns = router.urls
...@@ -5,5 +5,4 @@ from . import views ...@@ -5,5 +5,4 @@ from . import views
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register(r'events', views.KszkEventViewSet) router.register(r'events', views.KszkEventViewSet)
# app_name = 'stats'
urlpatterns = router.urls urlpatterns = router.urls
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment