diff --git a/.gitignore b/.gitignore index ce5b7a2..3639e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ ENV/ .ropeproject ccvpn/local_settings.py + +.vscode/ +.venv/ diff --git a/ccvpn/settings.py b/ccvpn/settings.py index abf4dfe..170ea6f 100644 --- a/ccvpn/settings.py +++ b/ccvpn/settings.py @@ -48,13 +48,12 @@ INSTALLED_APPS = ( 'constance.backends.database', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.common.BrokenLinkEmailsMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', diff --git a/ccvpn/urls.py b/ccvpn/urls.py index d3e6927..aae0c57 100644 --- a/ccvpn/urls.py +++ b/ccvpn/urls.py @@ -1,39 +1,37 @@ -from django.conf.urls import include, url +from django.urls import path, include from django.contrib import admin from django.contrib.auth import views as auth_views -from . import views +from lambdainst import views as account_views -from lambdainst import urls as account_urls, views as account_views -from payments import urls as payments_urls -from tickets import urls as tickets_urls +from . import views urlpatterns = [ - url(r'^admin/status$', account_views.admin_status, name='admin_status'), - url(r'^admin/referrers$', account_views.admin_ref, name='admin_ref'), - url(r'^admin/', include(admin.site.urls)), - - url(r'^api/locations$', account_views.api_locations), - url(r'^api/auth$', account_views.api_auth), - - url(r'^$', views.index, name='index'), - url(r'^ca.crt$', account_views.ca_crt), - url(r'^setlang$', views.set_lang, name='set_lang'), - url(r'^chat$', views.chat, name='chat'), - url(r'^page/(?P[a-zA-Z0-9_-]+)$', views.page, name='page'), - url(r'^status$', account_views.status), - - url(r'^account/forgot$', auth_views.password_reset, - {}, name='password_reset'), - url(r'^account/forgot_done$', auth_views.password_reset_done, - name='password_reset_done'), - url(r'^account/reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', - auth_views.password_reset_confirm, name='password_reset_confirm'), - url(r'^account/reset/done/$', auth_views.password_reset_complete, - name='password_reset_complete'), - - url(r'^account/', include(account_urls, namespace='account')), - url(r'^payments/', include(payments_urls, namespace='payments')), - url(r'^tickets/', include(tickets_urls, namespace='tickets')), - + path('admin/status', account_views.admin_status, name='admin_status'), + path('admin/referrers', account_views.admin_ref, name='admin_ref'), + path('admin/', admin.site.urls), + + path('api/locations', account_views.api_locations), + path('api/auth', account_views.api_auth), + + path('', views.index, name='index'), + path('ca.crt', account_views.ca_crt), + path('setlang', views.set_lang, name='set_lang'), + path('chat', views.chat, name='chat'), + path('page/', views.page, name='page'), + path('status', account_views.status), + + path('account/forgot', auth_views.PasswordResetView.as_view(), + {}, name='password_reset'), + path('account/forgot_done', auth_views.PasswordResetDoneView.as_view(), + name='password_reset_done'), + path('account/reset///', + auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), + path('account/reset/done/', auth_views.PasswordResetCompleteView.as_view(), + name='password_reset_complete'), + + path('account/', include('lambdainst.urls', namespace='account')), + path('payments/', include('payments.urls', namespace='payments')), + path('tickets/', include('tickets.urls', namespace='tickets')), ] + diff --git a/ccvpn/views.py b/ccvpn/views.py index e847b1f..31b48b9 100644 --- a/ccvpn/views.py +++ b/ccvpn/views.py @@ -1,6 +1,8 @@ import os.path +import re import markdown +from markdown.extensions.codehilite import CodeHiliteExtension from django.http import HttpResponseNotFound from django.shortcuts import render from django.conf import settings @@ -15,7 +17,11 @@ from constance import config from .common import get_price_float -md = markdown.Markdown(extensions=['toc', 'meta', 'codehilite(noclasses=True)']) +md = markdown.Markdown(extensions=[ + 'markdown.extensions.toc', + 'markdown.extensions.meta', + CodeHiliteExtension(noclasses=True), +]) def index(request): @@ -24,7 +30,7 @@ def index(request): def chat(request): - if request.user.is_authenticated(): + if request.user.is_authenticated: username = request.user.username + '|cc' else: username = "cc?" @@ -36,9 +42,9 @@ def set_lang(request): """ django.views.i18n.set_language() with GET """ next = request.GET.get('next', request.GET.get('next')) - if not is_safe_url(url=next, host=request.get_host()): + if not is_safe_url(url=next, allowed_hosts={request.get_host()}): next = request.META.get('HTTP_REFERER') - if not is_safe_url(url=next, host=request.get_host()): + if not is_safe_url(url=next, allowed_hosts={request.get_host()}): next = '/' response = http.HttpResponseRedirect(next) lang_code = request.GET.get('lang', None) @@ -54,6 +60,9 @@ def set_lang(request): def page(request, name): + if not re.match('^[a-z0-9_-]{1,50}$', name): + return HttpResponseNotFound() + basename = settings.PAGES_DIR + '/' + name username = request.user.username diff --git a/lambdainst/middleware.py b/lambdainst/middleware.py index 000ac4f..67ce1b6 100644 --- a/lambdainst/middleware.py +++ b/lambdainst/middleware.py @@ -1,11 +1,12 @@ from datetime import datetime, timedelta import re +from django.utils.deprecation import MiddlewareMixin from django.conf import settings from .models import User -class ReferrerMiddleware(): +class ReferrerMiddleware(MiddlewareMixin): def process_request(self, request): if 'ref' in request.GET: id = request.GET['ref'] @@ -42,7 +43,7 @@ class ReferrerMiddleware(): return response -class CampaignMiddleware(): +class CampaignMiddleware(MiddlewareMixin): GET_FIELDS = ['pk_campaign', 'utm_campaign', 'utm_medium', 'utm_source'] def _get_name(self, request): diff --git a/lambdainst/migrations/0001_initial.py b/lambdainst/migrations/0001_initial.py index ed7ecb5..e031b78 100644 --- a/lambdainst/migrations/0001_initial.py +++ b/lambdainst/migrations/0001_initial.py @@ -26,7 +26,7 @@ class Migration(migrations.Migration): ('free_only', models.BooleanField(default=True)), ('available', models.BooleanField(default=True)), ('comment', models.TextField(blank=True)), - ('created_by', models.ForeignKey(related_name='created_giftcode_set', null=True, blank=True, to=settings.AUTH_USER_MODEL)), + ('created_by', models.ForeignKey(related_name='created_giftcode_set', null=True, blank=True, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ 'verbose_name_plural': 'Gift Codes', @@ -38,8 +38,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)), ('date', models.DateTimeField(null=True, auto_now_add=True)), - ('code', models.ForeignKey(to='lambdainst.GiftCode')), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('code', models.ForeignKey(to='lambdainst.GiftCode', on_delete=models.CASCADE)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ 'verbose_name_plural': 'Gift Code Users', @@ -58,7 +58,7 @@ class Migration(migrations.Migration): ('last_vpn_auth', models.DateTimeField(null=True, blank=True)), ('referrer_used', models.BooleanField(default=False)), ('referrer', models.ForeignKey(related_name='referrals', null=True, on_delete=django.db.models.deletion.SET_NULL, blank=True, to=settings.AUTH_USER_MODEL)), - ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)), + ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ 'verbose_name_plural': 'VPN Users', diff --git a/lambdainst/models.py b/lambdainst/models.py index a1b2fd1..329bd80 100644 --- a/lambdainst/models.py +++ b/lambdainst/models.py @@ -158,8 +158,8 @@ class GiftCodeUser(models.Model): verbose_name = _("Gift Code User") verbose_name_plural = _("Gift Code Users") - user = models.ForeignKey(User) - code = models.ForeignKey(GiftCode) + user = models.ForeignKey(User, on_delete=models.CASCADE) + code = models.ForeignKey(GiftCode, on_delete=models.CASCADE) date = models.DateTimeField(auto_now_add=True, null=True, blank=True) def __str__(self): diff --git a/lambdainst/templatetags/active.py b/lambdainst/templatetags/active.py index 1dd1eed..07ff79f 100644 --- a/lambdainst/templatetags/active.py +++ b/lambdainst/templatetags/active.py @@ -1,7 +1,7 @@ import re from django import template -from django.core.urlresolvers import reverse, NoReverseMatch +from django.urls import reverse, NoReverseMatch register = template.Library() diff --git a/lambdainst/urls.py b/lambdainst/urls.py index 8979821..700735a 100644 --- a/lambdainst/urls.py +++ b/lambdainst/urls.py @@ -1,19 +1,21 @@ -from django.conf.urls import url +from django.urls import path from django.contrib.auth import views as auth_views from . import views +app_name = 'lambdainst' + urlpatterns = [ - url(r'^login$', auth_views.login, name='login'), - url(r'^discourse_login', views.discourse_login, name='discourse_login'), - url(r'^logout$', views.logout, name='logout'), - url(r'^signup$', views.signup, name='signup'), + path('login', auth_views.LoginView.as_view(), name='login'), + path('discourse_login', views.discourse_login, name='discourse_login'), + path('logout', views.logout, name='logout'), + path('signup', views.signup, name='signup'), - url(r'^settings', views.settings), - url(r'^config_dl', views.config_dl), - url(r'^config', views.config), - url(r'^logs', views.logs), - url(r'^gift_code', views.gift_code), - url(r'^trial', views.trial), - url(r'^', views.index, name='index'), + path('settings', views.settings), + path('config_dl', views.config_dl), + path('config', views.config), + path('logs', views.logs), + path('gift_code', views.gift_code), + path('trial', views.trial), + path('', views.index, name='index'), ] diff --git a/lambdainst/views.py b/lambdainst/views.py index c446897..b1e1aad 100644 --- a/lambdainst/views.py +++ b/lambdainst/views.py @@ -61,7 +61,7 @@ def logout(request): def signup(request): - if request.user.is_authenticated(): + if request.user.is_authenticated: return redirect('account:index') if request.method != 'POST': diff --git a/payments/backends/bitcoin.py b/payments/backends/bitcoin.py index 5fb17b4..b168920 100644 --- a/payments/backends/bitcoin.py +++ b/payments/backends/bitcoin.py @@ -2,7 +2,7 @@ from decimal import Decimal from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from constance import config as site_config from .base import BackendBase diff --git a/payments/backends/coinbase.py b/payments/backends/coinbase.py index e807a9b..92d569f 100644 --- a/payments/backends/coinbase.py +++ b/payments/backends/coinbase.py @@ -3,7 +3,7 @@ from ipaddress import IPv4Address, IPv4Network from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.conf import settings as project_settings from .base import BackendBase diff --git a/payments/backends/paypal.py b/payments/backends/paypal.py index 6a395cb..5a335ff 100644 --- a/payments/backends/paypal.py +++ b/payments/backends/paypal.py @@ -2,7 +2,7 @@ from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ from urllib.parse import urlencode from urllib.request import urlopen -from django.core.urlresolvers import reverse +from django.urls import reverse from django.conf import settings as project_settings from .base import BackendBase diff --git a/payments/backends/stripe.py b/payments/backends/stripe.py index a17310e..232bd69 100644 --- a/payments/backends/stripe.py +++ b/payments/backends/stripe.py @@ -1,7 +1,7 @@ import json from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from .base import BackendBase diff --git a/payments/migrations/0001_initial.py b/payments/migrations/0001_initial.py index 4706156..3425c63 100644 --- a/payments/migrations/0001_initial.py +++ b/payments/migrations/0001_initial.py @@ -44,17 +44,17 @@ class Migration(migrations.Migration): ('last_confirmed_payment', models.DateTimeField(null=True, blank=True)), ('backend_id', models.CharField(null=True, max_length=64, blank=True)), ('backend_data', jsonfield.fields.JSONField(blank=True, default=dict)), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], ), migrations.AddField( model_name='payment', name='recurring_source', - field=models.ForeignKey(null=True, to='payments.RecurringPaymentSource', blank=True), + field=models.ForeignKey(null=True, to='payments.RecurringPaymentSource', blank=True, on_delete=models.CASCADE), ), migrations.AddField( model_name='payment', name='user', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.SET_NULL), ), ] diff --git a/payments/models.py b/payments/models.py index 52bfbac..c24454f 100644 --- a/payments/models.py +++ b/payments/models.py @@ -98,7 +98,7 @@ class Payment(models.Model): amount = models.IntegerField() paid_amount = models.IntegerField(default=0) time = models.DurationField() - subscription = models.ForeignKey('Subscription', null=True, blank=True) + subscription = models.ForeignKey('Subscription', null=True, blank=True, on_delete=models.CASCADE) status_message = models.TextField(blank=True, null=True) backend_extid = models.CharField(max_length=64, null=True, blank=True) diff --git a/payments/urls.py b/payments/urls.py index a227769..5df6e3c 100644 --- a/payments/urls.py +++ b/payments/urls.py @@ -1,6 +1,8 @@ from django.conf.urls import url from . import views +app_name = 'payments' + urlpatterns = [ url(r'^new$', views.new), url(r'^view/(?P[0-9]+)$', views.view, name='view'), diff --git a/payments/views.py b/payments/views.py index 6293480..6460e5a 100644 --- a/payments/views.py +++ b/payments/views.py @@ -1,6 +1,6 @@ from datetime import timedelta from django.shortcuts import render, redirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound diff --git a/poetry.lock b/poetry.lock index 939d81d..9f988b4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,17 @@ +[[package]] +category = "dev" +description = "An abstract syntax tree for Python with inference support." +name = "astroid" +optional = false +python-versions = ">=3.4.*" +version = "2.2.5" + +[package.dependencies] +lazy-object-proxy = "*" +six = "*" +typed-ast = ">=1.3.0" +wrapt = "*" + [[package]] category = "main" description = "Python package for providing Mozilla's CA Bundle." @@ -14,13 +28,26 @@ optional = false python-versions = "*" version = "3.0.4" +[[package]] +category = "dev" +description = "Cross-platform colored terminal text." +marker = "sys_platform == \"win32\"" +name = "colorama" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.4.1" + [[package]] category = "main" description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." name = "django" optional = false -python-versions = "*" -version = "1.10" +python-versions = ">=3.5" +version = "2.2" + +[package.dependencies] +pytz = "*" +sqlparse = "*" [[package]] category = "main" @@ -28,7 +55,7 @@ description = "Django live settings with pluggable backends, including Redis." name = "django-constance" optional = false python-versions = "*" -version = "2.0.0" +version = "2.4.0" [package.dependencies] django-picklefield = "*" @@ -39,7 +66,7 @@ description = "Provides a country field for Django models." name = "django-countries" optional = false python-versions = "*" -version = "4.0" +version = "5.3.3" [[package]] category = "main" @@ -47,7 +74,10 @@ description = "JSONField for django models" name = "django-jsonfield" optional = false python-versions = "*" -version = "1.0.0" +version = "1.1.0" + +[package.dependencies] +Django = ">=1.9" [[package]] category = "main" @@ -56,7 +86,10 @@ marker = "extra == \"database\"" name = "django-picklefield" optional = false python-versions = "*" -version = "1.1.0" +version = "2.0" + +[package.dependencies] +Django = ">=1.11" [[package]] category = "main" @@ -66,6 +99,22 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "2.8" +[[package]] +category = "dev" +description = "A Python utility / library to sort Python imports." +name = "isort" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "4.3.17" + +[[package]] +category = "dev" +description = "A fast and thorough lazy object proxy." +name = "lazy-object-proxy" +optional = false +python-versions = "*" +version = "1.3.1" + [[package]] category = "main" description = "lambdacore client api" @@ -81,13 +130,25 @@ requests = "*" reference = "7eae4fa4a670849cc7b2a89bbca01b2b741e77ea" type = "git" url = "https://git.packetimpact.net/lvpn/lcoreapi.git" + [[package]] category = "main" description = "Python implementation of Markdown." name = "markdown" optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" +version = "3.1" + +[package.dependencies] +setuptools = ">=36" + +[[package]] +category = "dev" +description = "McCabe checker, plugin for flake8" +name = "mccabe" +optional = false python-versions = "*" -version = "2.6" +version = "0.6.1" [[package]] category = "main" @@ -97,6 +158,28 @@ optional = false python-versions = "*" version = "2.4.0" +[[package]] +category = "main" +description = "Pygments is a syntax highlighting package written in Python." +name = "pygments" +optional = false +python-versions = "*" +version = "2.3.1" + +[[package]] +category = "dev" +description = "python code static checker" +name = "pylint" +optional = false +python-versions = ">=3.4.*" +version = "2.3.1" + +[package.dependencies] +astroid = ">=2.2.0,<3" +colorama = "*" +isort = ">=4.2.5,<5" +mccabe = ">=0.6,<0.7" + [[package]] category = "main" description = "The Swiss Army Knife of the Bitcoin protocol." @@ -127,6 +210,22 @@ chardet = ">=3.0.2,<3.1.0" idna = ">=2.5,<2.9" urllib3 = ">=1.21.1,<1.25" +[[package]] +category = "dev" +description = "Python 2 and 3 compatibility utilities" +name = "six" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*" +version = "1.12.0" + +[[package]] +category = "main" +description = "Non-validating SQL parser" +name = "sqlparse" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.3.0" + [[package]] category = "main" description = "Python bindings for the Stripe API" @@ -140,6 +239,15 @@ version = "2.24.0" python = ">=3.0" version = ">=2.20" +[[package]] +category = "dev" +description = "a fork of Python 2 and 3 ast modules with type comment support" +marker = "implementation_name == \"cpython\"" +name = "typed-ast" +optional = false +python-versions = "*" +version = "1.3.1" + [[package]] category = "main" description = "HTTP library with thread-safe connection pooling, file post, and more." @@ -148,24 +256,43 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" version = "1.24.1" +[[package]] +category = "dev" +description = "Module for decorators, wrappers and monkey patching." +name = "wrapt" +optional = false +python-versions = "*" +version = "1.11.1" + [metadata] -content-hash = "136a5667e1f62f2a39a4ac1fbea6388f78ca0d9133a9ecae284fddd3c8d15188" -python-versions = "^3.4" +content-hash = "3a9661fbb78e1f50d6d7729e8fd239bb456c676699ada309d0a926e8be31adaf" +python-versions = "^3.5" [metadata.hashes] +astroid = ["6560e1e1749f68c64a4b5dee4e091fce798d2f0d84ebe638cf0e0585a343acf4", "b65db1bbaac9f9f4d190199bb8680af6f6f84fd3769a5ea883df8a91fe68b4c4"] certifi = ["59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5", "b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae"] chardet = ["84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", "fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"] -django = ["46b868d68e5fd69dd9e05a0a7900df91786097e30b2aa6f065dd7fa3b22f7005", "9c60f4a801bf7c26bd6824c1062550c12c373344116703461c18cc258f8c9320"] -django-constance = ["6eec9f3ac4e5657b93e64f3379181d1e727088df10dd34f0398cd12119b9f0b0", "8e906b084dbfd2ecc9aaa682865314221849718e126d5bc3bff0264ffed4c880"] -django-countries = ["8762ed8863e818c44619e10ab47a861546f465afe945fd5ddecb6f2ba294a646", "b08bf13f46d05917074662a4222e6a614f7caf40ecccbbbc321a572f1029214f"] -django-jsonfield = ["2280016e6bfe7f0398fbc63539ce688249fe67eaf23756726a493f4e885eb305"] -django-picklefield = ["8d1de6be099044ae61e55998b35de18a57499b946fe45781077f5cec4f73f0e0", "ce7fee5c6558fe5dc8924993d994ccde75bb75b91cd82787cbd4c92b95a69f9c"] +colorama = ["05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", "f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"] +django = ["7c3543e4fb070d14e10926189a7fcf42ba919263b7473dceaefce34d54e8a119", "a2814bffd1f007805b19194eb0b9a331933b82bd5da1c3ba3d7b7ba16e06dc4b"] +django-constance = ["19ff1ae8295aeffc2917ab67da4b310bfaf8c42f34d570f89e289fd54c4217b0", "417f9866a4fcd93c198acd16d5bc22b68e491eaabb18efea4c70d183d42daa45"] +django-countries = ["5307a61172eee5740720e44ea08721858b7d8bf8509ec7701ccd7a8d21120b9a", "e4eaaec9bddb9365365109f833d1fd0ecc0cfee3348bf5441c0ccefb2d6917cd"] +django-jsonfield = ["25e53eae8bda165721773145ee0f8ae53b746bb3051b32f2821ba84d79aa77ef", "813c52463fbbb548fe0d85bf935d0bf72e933fae2bb00ce3ba27bf69ff6fd2ad", "cacf5a21e7c2490109a60f1122c05aa3858a8dc06952ad764831b4428164fc8e"] +django-picklefield = ["9052f2dcf4882c683ce87b4356f29b4d014c0dad645b6906baf9f09571f52bc8", "f1733a8db1b6046c0d7d738e785f9875aa3c198215de11993463a9339aa4ea24"] idna = ["c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", "ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"] +isort = ["01cb7e1ca5e6c5b3f235f0385057f70558b70d2f00320208825fa62887292f43", "268067462aed7eb2a1e237fcb287852f22077de3fb07964e87e00f829eea2d1a"] +lazy-object-proxy = ["0ce34342b419bd8f018e6666bfef729aec3edf62345a53b537a4dcc115746a33", "1b668120716eb7ee21d8a38815e5eb3bb8211117d9a90b0f8e21722c0758cc39", "209615b0fe4624d79e50220ce3310ca1a9445fd8e6d3572a896e7f9146bbf019", "27bf62cb2b1a2068d443ff7097ee33393f8483b570b475db8ebf7e1cba64f088", "27ea6fd1c02dcc78172a82fc37fcc0992a94e4cecf53cb6d73f11749825bd98b", "2c1b21b44ac9beb0fc848d3993924147ba45c4ebc24be19825e57aabbe74a99e", "2df72ab12046a3496a92476020a1a0abf78b2a7db9ff4dc2036b8dd980203ae6", "320ffd3de9699d3892048baee45ebfbbf9388a7d65d832d7e580243ade426d2b", "50e3b9a464d5d08cc5227413db0d1c4707b6172e4d4d915c1c70e4de0bbff1f5", "5276db7ff62bb7b52f77f1f51ed58850e315154249aceb42e7f4c611f0f847ff", "61a6cf00dcb1a7f0c773ed4acc509cb636af2d6337a08f362413c76b2b47a8dd", "6ae6c4cb59f199d8827c5a07546b2ab7e85d262acaccaacd49b62f53f7c456f7", "7661d401d60d8bf15bb5da39e4dd72f5d764c5aff5a86ef52a042506e3e970ff", "7bd527f36a605c914efca5d3d014170b2cb184723e423d26b1fb2fd9108e264d", "7cb54db3535c8686ea12e9535eb087d32421184eacc6939ef15ef50f83a5e7e2", "7f3a2d740291f7f2c111d86a1c4851b70fb000a6c8883a59660d95ad57b9df35", "81304b7d8e9c824d058087dcb89144842c8e0dea6d281c031f59f0acf66963d4", "933947e8b4fbe617a51528b09851685138b49d511af0b6c0da2539115d6d4514", "94223d7f060301b3a8c09c9b3bc3294b56b2188e7d8179c762a1cda72c979252", "ab3ca49afcb47058393b0122428358d2fbe0408cf99f1b58b295cfeb4ed39109", "bd6292f565ca46dee4e737ebcc20742e3b5be2b01556dafe169f6c65d088875f", "cb924aa3e4a3fb644d0c463cad5bc2572649a6a3f68a7f8e4fbe44aaa6d77e4c", "d0fc7a286feac9077ec52a927fc9fe8fe2fabab95426722be4c953c9a8bede92", "ddc34786490a6e4ec0a855d401034cbd1242ef186c20d79d2166d6a4bd449577", "e34b155e36fa9da7e1b7c738ed7767fc9491a62ec6af70fe9da4a057759edc2d", "e5b9e8f6bda48460b7b143c3821b21b452cb3a835e6bbd5dd33aa0c8d3f5137d", "e81ebf6c5ee9684be8f2c87563880f93eedd56dd2b6146d8a725b50b7e5adb0f", "eb91be369f945f10d3a49f5f9be8b3d0b93a4c2be8f8a5b83b0571b8123e0a7a", "f460d1ceb0e4a5dcb2a652db0904224f367c9b3c1470d5a7683c0480e582468b"] lcoreapi = [] -markdown = ["9d8658d81626c03ee9d9dfcbb516382dd9064e21eeb184dda19ab42b168c8633", "e1c8a489bb7c7154bc5a8c14f0fd1fc356ee36c8b9988f9fd8febff22dd435da"] +markdown = ["fc4a6f69a656b8d858d7503bda633f4dd63c2d70cf80abdc6eafa64c4ae8c250", "fe463ff51e679377e3624984c829022e2cfb3be5518726b06f608a07a3aad680"] +mccabe = ["ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"] pygal = ["27abab93cbc31e21f3c6bdecc05bda6cd3570cbdbd8297b7caa6904051b50d72", "9204f05380b02a8a32f9bf99d310b51aa2a932cba5b369f7a4dc3705f0a4ce83"] +pygments = ["5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", "e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d"] +pylint = ["5d77031694a5fb97ea95e828c8d10fc770a1df6eb3906067aaed42201a8a6a09", "723e3db49555abaf9bf79dc474c6b9e2935ad82230b10c1138a71ea41ac0fff1"] python-bitcoinlib = ["0fe7de6c083e12479eb12d3764ece83e5c73b1c48e806009ee1a1aa02da098cf", "4c5ab6d6937086b2964a97182ca04d9a7ecfe9295ab9520f58ac13a1f54e9183"] pytz = ["32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", "d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c"] requests = ["502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", "7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"] +six = ["3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"] +sqlparse = ["40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", "7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873"] stripe = ["337149778e544c03d7a69da387b1ada1297c5878891dfa569e482c5433997e80", "3f7eac3b55035071cc0142315aea976cc36dae61525223f0d3030450e9587f76"] +typed-ast = ["035a54ede6ce1380599b2ce57844c6554666522e376bd111eb940fbc7c3dad23", "037c35f2741ce3a9ac0d55abfcd119133cbd821fffa4461397718287092d9d15", "049feae7e9f180b64efacbdc36b3af64a00393a47be22fa9cb6794e68d4e73d3", "19228f7940beafc1ba21a6e8e070e0b0bfd1457902a3a81709762b8b9039b88d", "2ea681e91e3550a30c2265d2916f40a5f5d89b59469a20f3bad7d07adee0f7a6", "3a6b0a78af298d82323660df5497bcea0f0a4a25a0b003afd0ce5af049bd1f60", "5385da8f3b801014504df0852bf83524599df890387a3c2b17b7caa3d78b1773", "606d8afa07eef77280c2bf84335e24390055b478392e1975f96286d99d0cb424", "69245b5b23bbf7fb242c9f8f08493e9ecd7711f063259aefffaeb90595d62287", "6f6d839ab09830d59b7fa8fb6917023d8cb5498ee1f1dbd82d37db78eb76bc99", "730888475f5ac0e37c1de4bd05eeb799fdb742697867f524dc8a4cd74bcecc23", "9819b5162ffc121b9e334923c685b0d0826154e41dfe70b2ede2ce29034c71d8", "9e60ef9426efab601dd9aa120e4ff560f4461cf8442e9c0a2b92548d52800699", "af5fbdde0690c7da68e841d7fc2632345d570768ea7406a9434446d7b33b0ee1", "b64efdbdf3bbb1377562c179f167f3bf301251411eb5ac77dec6b7d32bcda463", "bac5f444c118aeb456fac1b0b5d14c6a71ea2a42069b09c176f75e9bd4c186f6", "bda9068aafb73859491e13b99b682bd299c1b5fd50644d697533775828a28ee0", "d659517ca116e6750101a1326107d3479028c5191f0ecee3c7203c50f5b915b0", "eddd3fb1f3e0f82e5915a899285a39ee34ce18fd25d89582bc89fc9fb16cd2c6"] urllib3 = ["61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", "de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"] +wrapt = ["4aea003270831cceb8a90ff27c4031da6ead7ec1886023b80ce0dfe0adf61533"] diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..860ab59 --- /dev/null +++ b/pylintrc @@ -0,0 +1,84 @@ +[MESSAGES CONTROL] + +disable=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape, + missing-docstring, + trailing-newlines + diff --git a/pyproject.toml b/pyproject.toml index c019e9f..d9d8adf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,20 +5,22 @@ description = "" authors = ["CCrypto "] [tool.poetry.dependencies] -python = "^3.4" -django = "=1.10" -django-jsonfield = "=1.0" -django_countries = "=4.0" -markdown = "=2.6" +python = "^3.5" +django = "=2.2" +django-jsonfield = "=1.1" +django_countries = "=5.3.3" +markdown = "=3.1" requests = "^2.21" pygal = "^2.4" pytz = "^2018.9" python-bitcoinlib = "^0.10.1" stripe = "^2.24" -django-constance = {version = "=2.0",extras = ["database"]} +django-constance = {version = "=2.4",extras = ["database"]} lcoreapi = {git = "https://git.packetimpact.net/lvpn/lcoreapi.git"} +pygments = "^2.3" [tool.poetry.dev-dependencies] +pylint = "^2.3" [build-system] requires = ["poetry>=0.12"] diff --git a/tickets/migrations/0001_initial.py b/tickets/migrations/0001_initial.py index 421b836..cf01ebb 100644 --- a/tickets/migrations/0001_initial.py +++ b/tickets/migrations/0001_initial.py @@ -37,7 +37,7 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(auto_now_add=True)), ('message', models.TextField()), ('staff_only', models.BooleanField(default=False)), - ('ticket', models.ForeignKey(related_name='message_set', to='tickets.Ticket')), + ('ticket', models.ForeignKey(related_name='message_set', to='tickets.Ticket', on_delete=models.CASCADE)), ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=django.db.models.deletion.SET_NULL)), ], ), diff --git a/tickets/models.py b/tickets/models.py index c021811..72f8a08 100644 --- a/tickets/models.py +++ b/tickets/models.py @@ -1,7 +1,7 @@ from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.template.loader import get_template from django.template import Context from django.core.mail import send_mail diff --git a/tickets/urls.py b/tickets/urls.py index 8baf96f..d878a84 100644 --- a/tickets/urls.py +++ b/tickets/urls.py @@ -1,14 +1,16 @@ -from django.conf.urls import url +from django.urls import path from . import views +app_name = 'tickets' + urlpatterns = [ - url(r'^new$', views.new, name='new'), - url(r'^view/(?P[0-9]+)$', views.view, name='view'), - url(r'^$', views.index, name='index'), - url(r'^open$', views.index, dict(f='open'), name='index_open'), - url(r'^closed$', views.index, dict(f='closed'), name='index_closed'), - url(r'^all_open$', views.index, dict(f='open', all=True), name='index_open_all'), - url(r'^all_closed$', views.index, dict(f='closed', all=True), name='index_closed_all'), + path('new', views.new, name='new'), + path('view/', views.view, name='view'), + path('', views.index, name='index'), + path('open', views.index, dict(f='open'), name='index_open'), + path('closed', views.index, dict(f='closed'), name='index_closed'), + path('all_open', views.index, dict(f='open', all=True), name='index_open_all'), + path('all_closed', views.index, dict(f='closed', all=True), name='index_closed_all'), ]