Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all the deprecated-warnings and upgrade django to 1.11 #664

Open
wants to merge 15 commits into
base: django-2.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions junction/conferences/migrations/0016_auto_20200410_1926.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-04-10 13:56
from __future__ import unicode_literals

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("conferences", "0015_auto_20200322_1904"),
]

operations = [
migrations.AddField(
model_name="historicalconferenceproposalreviewer",
name="history_change_reason",
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name="historicalconferenceproposalreviewer",
name="created_by",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to=settings.AUTH_USER_MODEL,
verbose_name="Created By",
),
),
migrations.AlterField(
model_name="historicalconferenceproposalreviewer",
name="modified_by",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to=settings.AUTH_USER_MODEL,
verbose_name="Modified By",
),
),
]
2 changes: 1 addition & 1 deletion junction/conferences/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def is_reviewer(user, conference):
"""Returns a boolean indicating if a given user is a conference reviewer.
"""
if not user.is_authenticated():
if not user.is_authenticated:
return False

qs = ConferenceProposalReviewer.objects.filter(
Expand Down
5 changes: 3 additions & 2 deletions junction/conferences/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from django.http.response import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_http_methods
from rest_framework import filters, viewsets
from django_filters import rest_framework as filters
from rest_framework import viewsets

from .models import Conference, ConferenceVenue, Room
from .serializers import ConferenceSerializer, RoomSerializer, VenueSerializer
Expand All @@ -25,7 +26,7 @@ class RoomView(viewsets.ReadOnlyModelViewSet):
queryset = Room.objects.all()
serializer_class = RoomSerializer
filter_backend = (filters.DjangoFilterBackend,)
filter_fields = ("venue",)
filterset_fields = ("venue",)


@require_http_methods(["GET"])
Expand Down
8 changes: 1 addition & 7 deletions junction/devices/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import uuidfield.fields
from django.db import migrations, models

import junction.devices.models
Expand Down Expand Up @@ -34,12 +33,7 @@ class Migration(migrations.Migration):
auto_now=True, verbose_name="Last Modified At"
),
),
(
"uuid",
uuidfield.fields.UUIDField(
unique=True, max_length=32, db_index=True
),
),
("uuid", models.UUIDField(max_length=32, unique=True, db_index=True)),
("is_verified", models.BooleanField(default=False)),
("verification_code", models.IntegerField()),
(
Expand Down
4 changes: 1 addition & 3 deletions junction/devices/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-

import datetime

from django.db import models
from django.utils.timezone import now
from uuidfield import UUIDField

from junction.base.models import TimeAuditModel

Expand All @@ -14,7 +12,7 @@ def expiry_time(expiry_mins=60):


class Device(TimeAuditModel):
uuid = UUIDField(version=1, hyphenate=True, unique=True, db_index=True)
uuid = models.UUIDField(unique=True, max_length=32, db_index=True)

# Verification
is_verified = models.BooleanField(default=False)
Expand Down
2 changes: 1 addition & 1 deletion junction/proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _get_proposal_section_reviewer_vote_choices(conference):
return values


class HorizRadioRenderer(forms.RadioSelect.renderer):
class HorizRadioRenderer(forms.RadioSelect):

"""
This overrides widget method to put radio buttons horizontally instead of vertically.
Expand Down
84 changes: 84 additions & 0 deletions junction/proposals/migrations/0028_auto_20200507_1202.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-05-07 06:32
from __future__ import unicode_literals

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("proposals", "0027_auto_20200502_0540"),
]

operations = [
migrations.AddField(
model_name="historicalproposal",
name="history_change_reason",
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name="historicalproposalsectionreviewervote",
name="history_change_reason",
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name="historicalproposal",
name="author",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to=settings.AUTH_USER_MODEL,
verbose_name="Primary Speaker",
),
),
migrations.AlterField(
model_name="historicalproposal",
name="proposal_section",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="proposals.ProposalSection",
verbose_name="Proposal Section",
),
),
migrations.AlterField(
model_name="historicalproposal",
name="proposal_type",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="proposals.ProposalType",
verbose_name="Proposal Type",
),
),
migrations.AlterField(
model_name="historicalproposal",
name="video_url",
field=models.URLField(
blank=True,
default="",
help_text="Short 1-2 min video describing your talk",
),
),
migrations.AlterField(
model_name="proposal",
name="video_url",
field=models.URLField(
blank=True,
default="",
help_text="Short 1-2 min video describing your talk",
),
),
]
6 changes: 3 additions & 3 deletions junction/proposals/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def is_proposal_voting_allowed(proposal):


def is_proposal_author(user, proposal):
return user.is_authenticated() and proposal.author == user
return user.is_authenticated and proposal.author == user


def is_proposal_reviewer(user, conference):
authenticated = user.is_authenticated()
authenticated = user.is_authenticated
is_reviewer = ConferenceProposalReviewer.objects.filter(
reviewer=user.id, conference=conference, active=True
).exists()
Expand All @@ -26,7 +26,7 @@ def is_proposal_reviewer(user, conference):

def is_proposal_section_reviewer(user, conference, proposal):
return (
user.is_authenticated()
user.is_authenticated
and ProposalSectionReviewer.objects.filter(
conference_reviewer__reviewer=user,
conference_reviewer__conference=conference,
Expand Down
12 changes: 9 additions & 3 deletions junction/proposals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from django.http.response import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_http_methods
from django_filters import rest_framework as filters
from hashids import Hashids
from rest_framework import filters, viewsets
from rest_framework import viewsets
from rest_framework.response import Response

from junction.base.constants import (
Expand All @@ -39,7 +40,12 @@ class ProposalView(viewsets.ReadOnlyModelViewSet):
queryset = Proposal.objects.filter(status=2)
serializer_class = serializers.ProposalSerializer
filter_backend = (filters.DjangoFilterBackend,)
filter_fields = ("conference", "review_status", "proposal_type", "proposal_section")
filterset_fields = (
"conference",
"review_status",
"proposal_type",
"proposal_section",
)

def get_queryset(self):
data = super(ProposalView, self).get_queryset()
Expand Down Expand Up @@ -233,7 +239,7 @@ def detail_proposal(request, conference_slug, slug, hashid=None):
if public_voting_setting:
public_voting_setting_value = public_voting_setting.value
try:
if request.user.is_authenticated():
if request.user.is_authenticated:
proposal_vote = ProposalVote.objects.get(
proposal=proposal, voter=request.user
)
Expand Down
5 changes: 3 additions & 2 deletions junction/schedule/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from django.http import HttpResponse
from django.shortcuts import Http404, render
from django.template.loader import render_to_string
from rest_framework import filters, viewsets
from django_filters import rest_framework as filters
from rest_framework import viewsets
from rest_framework.response import Response

from .models import ScheduleItem
Expand All @@ -17,7 +18,7 @@ class ScheduleView(viewsets.ReadOnlyModelViewSet):
queryset = ScheduleItem.objects.all()
serializer_class = ScheduleSerializer
filter_backend = (filters.DjangoFilterBackend,)
filter_fields = ("room", "conference", "event_date")
filterset_fields = ("room", "conference", "event_date")

def get_queryset(self):
data = (
Expand Down
2 changes: 1 addition & 1 deletion junction/tickets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class Ticket(AuditModel):
others = JSONField()

def __str__(self):
return self.name, self.email, self.ticket_no
return "{} : {} : {}".format(self.name, self.email, self.ticket_no)
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Django==1.9
celery==3.1.20
djangorestframework==3.4
django-filter==1.0.1
Django==1.11.17
celery==4.4.2
djangorestframework==3.11.0
django-filter==2.2.0

# Persistent Store
# -------------------------------------------------
Expand Down Expand Up @@ -35,20 +35,20 @@ mock==2.0.0 # Django all auth needs

# Admin
# -------------------------------------------------
django_simple_history==1.8.0
django_simple_history==2.8.0

# Frontend Helpers
# -------------------------------------------------
django-bootstrap3==7.1.0
django-bootstrap-breadcrumbs==0.8
django-bootstrap3==11.0.0
django-bootstrap-breadcrumbs==0.9.2
django-flat-theme==1.1.3

# Markdown Editor
# -------------------------------------------------
django-markdown==0.8.4
django-pagedown==0.1.
django-markdown-app==0.9.3.1
django-pagedown==1.0.6
mdx-linkify==0.6
Markdown==2.6.6
Markdown==2.6.7
markdown2==2.3.1

# Server
Expand Down
4 changes: 0 additions & 4 deletions settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@
# Make sure DB request held on for minimim 5 minutes
CONN_MAX_AGE = 300

REST_FRAMEWORK = {
"DEFAULT_FILTER_BACKENDS": ("rest_framework.filters.DjangoFilterBackend",)
}

EXPLARA_API_TOKEN = "shjbalkfbdskjlbdskljbdskaljfb"

QR_CODES_DIR = ROOT_DIR + "/qr_files"
Expand Down
2 changes: 1 addition & 1 deletion settings/dev.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DATABASES = {
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'http'

TEMPLATES[0]['OPTIONS']['context_processors'].extend([
"django.core.context_processors.debug",
"django.template.context_processors.debug",
])

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Expand Down
2 changes: 1 addition & 1 deletion settings/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

TEMPLATES[0]["OPTIONS"]["context_processors"].extend(
["django.core.context_processors.debug",]
["django.template.context_processors.debug",]
)

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
Expand Down
2 changes: 1 addition & 1 deletion tools/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
factory-boy==2.11.1

pytest-django==3.4.8
pytest-django==3.9.0
pytest-cov==2.6.1

coverage==5.0.4