Remove non-required code and format with black
This commit is contained in:
parent
811e87ff09
commit
996ac1312c
|
@ -48,3 +48,6 @@ docs/_build
|
|||
|
||||
# Editors
|
||||
.vscode
|
||||
|
||||
# Project specific
|
||||
example/db.sqlite3
|
||||
|
|
|
@ -62,7 +62,7 @@ Does the code actually work?
|
|||
|
||||
source <YOURVIRTUALENV>/bin/activate
|
||||
(myenv) $ pip install tox
|
||||
(myenv) $ tox
|
||||
(myenv) $ tox -e <your-python-version>-django-22
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
|
|
@ -3,4 +3,4 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class DjangoCryptolockConfig(AppConfig):
|
||||
name = 'django_cryptolock'
|
||||
name = "django_cryptolock"
|
||||
|
|
|
@ -7,6 +7,3 @@ from model_utils.models import TimeStampedModel
|
|||
|
||||
class Address(TimeStampedModel):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,31 +5,5 @@ from django.views.generic import TemplateView
|
|||
from . import views
|
||||
|
||||
|
||||
app_name = 'django_cryptolock'
|
||||
urlpatterns = [
|
||||
url(
|
||||
regex="^Address/~create/$",
|
||||
view=views.AddressCreateView.as_view(),
|
||||
name='Address_create',
|
||||
),
|
||||
url(
|
||||
regex="^Address/(?P<pk>\d+)/~delete/$",
|
||||
view=views.AddressDeleteView.as_view(),
|
||||
name='Address_delete',
|
||||
),
|
||||
url(
|
||||
regex="^Address/(?P<pk>\d+)/$",
|
||||
view=views.AddressDetailView.as_view(),
|
||||
name='Address_detail',
|
||||
),
|
||||
url(
|
||||
regex="^Address/(?P<pk>\d+)/~update/$",
|
||||
view=views.AddressUpdateView.as_view(),
|
||||
name='Address_update',
|
||||
),
|
||||
url(
|
||||
regex="^Address/$",
|
||||
view=views.AddressListView.as_view(),
|
||||
name='Address_list',
|
||||
),
|
||||
]
|
||||
app_name = "django_cryptolock"
|
||||
urlpatterns = []
|
||||
|
|
|
@ -4,35 +4,7 @@ from django.views.generic import (
|
|||
DeleteView,
|
||||
DetailView,
|
||||
UpdateView,
|
||||
ListView
|
||||
ListView,
|
||||
)
|
||||
|
||||
from .models import (
|
||||
Address,
|
||||
)
|
||||
|
||||
|
||||
class AddressCreateView(CreateView):
|
||||
|
||||
model = Address
|
||||
|
||||
|
||||
class AddressDeleteView(DeleteView):
|
||||
|
||||
model = Address
|
||||
|
||||
|
||||
class AddressDetailView(DetailView):
|
||||
|
||||
model = Address
|
||||
|
||||
|
||||
class AddressUpdateView(UpdateView):
|
||||
|
||||
model = Address
|
||||
|
||||
|
||||
class AddressListView(ListView):
|
||||
|
||||
model = Address
|
||||
|
||||
from .models import Address
|
||||
|
|
|
@ -29,57 +29,54 @@ ALLOWED_HOSTS = []
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
'django_cryptolock',
|
||||
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django_cryptolock",
|
||||
# if your app has other dependencies that need to be added to the site
|
||||
# they should be added here
|
||||
]
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'example.urls'
|
||||
ROOT_URLCONF = "example.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates'), ],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [os.path.join(BASE_DIR, "templates")],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'example.wsgi.application'
|
||||
WSGI_APPLICATION = "example.wsgi.application"
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,25 +85,19 @@ DATABASES = {
|
|||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
|
||||
},
|
||||
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
|
||||
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
|
||||
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
||||
]
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = "en-us"
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = "UTC"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
@ -117,4 +108,4 @@ USE_TZ = True
|
|||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_URL = "/static/"
|
||||
|
|
|
@ -18,6 +18,6 @@ from django.contrib import admin
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'', include('django_cryptolock.urls', namespace='django_cryptolock')),
|
||||
url(r"^admin/", admin.site.urls),
|
||||
url(r"", include("django_cryptolock.urls", namespace="django_cryptolock")),
|
||||
]
|
||||
|
|
|
@ -1,88 +1,66 @@
|
|||
{% load staticfiles i18n %}<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
{% load staticfiles i18n %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
||||
<title>{% block title %}Django-Cryptolock{% endblock title %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="author" content="" />
|
||||
|
||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
{% block css %}
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css">
|
||||
{% block css %} {% endblock %}
|
||||
</head>
|
||||
|
||||
<!-- Your stuff: Third-party css libraries go here -->
|
||||
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="m-b">
|
||||
<nav class="navbar navbar-dark navbar-static-top bg-inverse">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">django-cryptolock</a>
|
||||
<button type="button" class="navbar-toggler hidden-sm-up pull-xs-right" data-toggle="collapse"
|
||||
data-target="#bs-navbar-collapse-1">
|
||||
☰
|
||||
</button>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-toggleable-xs" id="bs-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
<body>
|
||||
<div class="m-b">
|
||||
<nav>
|
||||
<div>
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if messages %} {% for message in messages %}
|
||||
<div
|
||||
class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}"
|
||||
>
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %} {% endif %}
|
||||
<!-- Page content -->
|
||||
{% block content %}
|
||||
<div class="row m-t-2">
|
||||
<div>
|
||||
<p>Use this document as a way to quick start any new project.</p>
|
||||
<p>The current template is loaded from
|
||||
<code>django-cryptolock/example/templates/base.html</code>. </p>
|
||||
<p>Whenever you overwrite the contents of <code>django-cryptolock/django_cryptolock/urls.py</code> with your
|
||||
own content, you should see it here.</p>
|
||||
<p>
|
||||
The current template is loaded from
|
||||
<code>django-cryptolock/example/templates/base.html</code>.
|
||||
</p>
|
||||
<p>
|
||||
Whenever you overwrite the contents of
|
||||
<code>django-cryptolock/django_cryptolock/urls.py</code> with your own
|
||||
content, you should see it here.
|
||||
</p>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
</div>
|
||||
|
||||
</div> <!-- /container -->
|
||||
{% block modal %}{% endblock modal %}
|
||||
|
||||
{% block modal %}{% endblock modal %}
|
||||
|
||||
<!-- Le javascript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
{% block javascript %}
|
||||
<!-- Latest JQuery -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
||||
|
||||
<!-- Tether - a requirement for Bootstrap tooltips -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js"></script>
|
||||
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script>
|
||||
|
||||
<!-- Your stuff: Third-party javascript libraries go here -->
|
||||
|
||||
{% endblock javascript %}
|
||||
</body>
|
||||
<!-- Javascript ======================= -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
{% block javascript %} {% endblock javascript %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ from django.test.utils import get_runner
|
|||
|
||||
def run_tests(*test_args):
|
||||
if not test_args:
|
||||
test_args = ['tests']
|
||||
test_args = ["tests"]
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
|
||||
django.setup()
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner()
|
||||
|
@ -22,5 +22,5 @@ def run_tests(*test_args):
|
|||
sys.exit(bool(failures))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
run_tests(*sys.argv[1:])
|
||||
|
|
54
setup.py
54
setup.py
|
@ -14,61 +14,59 @@ def get_version(*file_paths):
|
|||
"""Retrieves the version from django_cryptolock/__init__.py"""
|
||||
filename = os.path.join(os.path.dirname(__file__), *file_paths)
|
||||
version_file = open(filename).read()
|
||||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
|
||||
version_file, re.M)
|
||||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
|
||||
if version_match:
|
||||
return version_match.group(1)
|
||||
raise RuntimeError('Unable to find version string.')
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
version = get_version("django_cryptolock", "__init__.py")
|
||||
|
||||
|
||||
if sys.argv[-1] == 'publish':
|
||||
if sys.argv[-1] == "publish":
|
||||
try:
|
||||
import wheel
|
||||
|
||||
print("Wheel version: ", wheel.__version__)
|
||||
except ImportError:
|
||||
print('Wheel library missing. Please run "pip install wheel"')
|
||||
sys.exit()
|
||||
os.system('python setup.py sdist upload')
|
||||
os.system('python setup.py bdist_wheel upload')
|
||||
os.system("python setup.py sdist upload")
|
||||
os.system("python setup.py bdist_wheel upload")
|
||||
sys.exit()
|
||||
|
||||
if sys.argv[-1] == 'tag':
|
||||
if sys.argv[-1] == "tag":
|
||||
print("Tagging the version on git:")
|
||||
os.system("git tag -a %s -m 'version %s'" % (version, version))
|
||||
os.system("git push --tags")
|
||||
sys.exit()
|
||||
|
||||
readme = open('README.rst').read()
|
||||
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
|
||||
readme = open("README.rst").read()
|
||||
history = open("HISTORY.rst").read().replace(".. :changelog:", "")
|
||||
|
||||
setup(
|
||||
name='django-cryptolock',
|
||||
name="django-cryptolock",
|
||||
version=version,
|
||||
description="""Django authentication using cryptocurrency wallets""",
|
||||
long_description=readme + '\n\n' + history,
|
||||
author='Gonçalo Valério',
|
||||
author_email='gon@ovalerio.net',
|
||||
url='https://github.com/dethos/django-cryptolock',
|
||||
packages=[
|
||||
'django_cryptolock',
|
||||
],
|
||||
long_description=readme + "\n\n" + history,
|
||||
author="Gonçalo Valério",
|
||||
author_email="gon@ovalerio.net",
|
||||
url="https://github.com/dethos/django-cryptolock",
|
||||
packages=["django_cryptolock"],
|
||||
include_package_data=True,
|
||||
install_requires=["django-model-utils>=2.0",],
|
||||
install_requires=["django-model-utils>=2.0"],
|
||||
license="MIT",
|
||||
zip_safe=False,
|
||||
keywords='django-cryptolock',
|
||||
keywords="django-cryptolock",
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Framework :: Django :: 2.2',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Natural Language :: English',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Framework :: Django :: 2.2",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Natural Language :: English",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -9,12 +9,7 @@ USE_TZ = True
|
|||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = "!z^^097u*@)yq#w1n14m%uh-l67#h&uft9p+m%$$(0y(s%-q7o"
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": ":memory:",
|
||||
}
|
||||
}
|
||||
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
|
||||
|
||||
ROOT_URLCONF = "tests.urls"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ from django_cryptolock import models
|
|||
|
||||
|
||||
class TestDjango_cryptolock(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ from django.conf.urls import url, include
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include('django_cryptolock.urls', namespace='django_cryptolock')),
|
||||
url(r"^", include("django_cryptolock.urls", namespace="django_cryptolock"))
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue