Commit 4838c75b authored by alexandre's avatar alexandre

Merged in the django project

parent ea8355fb
# If you need to exclude files such as those generated by an IDE, use
# $GIT_DIR/info/exclude or the core.excludesFile configuration variable as
# described in https://git-scm.com/docs/gitignore
*.egg-info
*.pot
*.py[co]
.tox/
__pycache__
MANIFEST
dist/
docs/_build/
docs/locale/
node_modules/
tests/coverage_html/
tests/.coverage
build/
tests/report/
*.sqlite3
git clone
cd
virtualenv python 3
pip install -r requirements/base.txt
python manage.py migrate
python manage.py createsuperuser
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "organon.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
LOCAL_SETTINGS = True
from .settings import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_gs%q+2!)n#^33k45wie13vtxj7yv)zu8zhekz)p*i4gs*p*8%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LOCAL_SETTINGS = True
from .settings import *
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_gs%q+2!)n#^33k45wie13vtxj7yv)zu8zhekz)p*i4gs*p*8%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
"""
Django settings for organon project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'playground',
]
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 = 'organon.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'organon', '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 = 'organon.wsgi.application'
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
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',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Django registration
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
try:
LOCAL_SETTINGS
except NameError:
try:
from .local_settings import *
except ImportError:
pass
{% block title %}{% endblock %}
{% block content %}{% endblock %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Activation Failure" %}{% endblock %}
{% block content %}
<p>{% trans "Account activation failed." %}</p>
{% endblock %}
{% comment %}
**registration/activate.html**
Used if account activation fails. With the default setup, has the following context:
``activation_key``
The activation key used during the activation attempt.
{% endcomment %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Account Activated" %}{% endblock %}
{% block content %}
<p>
{% trans "Your account is now activated." %}
{% if not user.is_authenticated %}
{% trans "You can log in." %}
{% endif %}
</p>
{% endblock %}
{% comment %}
**registration/activation_complete.html**
Used after successful account activation. This template has no context
variables of its own, and should simply inform the user that their
account is now active.
{% endcomment %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Account Activated" %}{% endblock %}
{% block content %}
<p>
{% trans "Your account is now activated." %}
{% if not user.is_authenticated %}
{% trans "Once a site administrator activates your account you can login." %}
{% endif %}
</p>
{% endblock %}
{% comment %}
**registration/activation_complete.html**
Used after successful account activation. This template has no context
variables of its own, and should simply inform the user that their
account is now active.
{% endcomment %}
{% load i18n %}
<!doctype html>
<html lang="en">
<head>
<title>{{ site.name }} {% trans "registration" %}</title>
</head>
<body>
<p>
{% blocktrans with site_name=site.name %}
You (or someone pretending to be you) have asked to register an account at
{{ site_name }}. If this wasn't you, please ignore this email
and your address will be removed from our records.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
To activate this account, please click the following link within the next
{{ expiration_days }} days:
{% endblocktrans %}
</p>
<p>
<a href="http://{{site.domain}}{% url 'registration_activate' activation_key %}">
{{site.domain}}{% url 'registration_activate' activation_key %}
</a>
</p>
<p>
{% blocktrans with site_name=site.name %}
Sincerely,
{{ site_name }} Management
{% endblocktrans %}
</p>
</body>
</html>
{% comment %}
**registration/activation_email.html**
Used to generate the html body of the activation email. Should display a
link the user can click to activate the account. This template has the
following context:
``activation_key``
The activation key for the new account.
``expiration_days``
The number of days remaining during which the account may be
activated.
``site``
An object representing the site on which the user registered;
depending on whether ``django.contrib.sites`` is installed, this
may be an instance of either ``django.contrib.sites.models.Site``
(if the sites application is installed) or
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
documentation for the Django sites framework
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
details regarding these objects' interfaces.
``user``
The new user account
``request``
``HttpRequest`` instance for better flexibility.
For example it can be used to compute absolute register URL:
{{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %}
{% endcomment %}
{% load i18n %}
{% blocktrans with site_name=site.name %}
You (or someone pretending to be you) have asked to register an account at
{{ site_name }}. If this wasn't you, please ignore this email
and your address will be removed from our records.
{% endblocktrans %}
{% blocktrans %}
To activate this account, please click the following link within the next
{{ expiration_days }} days:
{% endblocktrans %}
http://{{site.domain}}{% url 'registration_activate' activation_key %}
{% blocktrans with site_name=site.name %}
Sincerely,
{{ site_name }} Management
{% endblocktrans %}
{% comment %}
**registration/activation_email.txt**
Used to generate the text body of the activation email. Should display a
link the user can click to activate the account. This template has the
following context:
``activation_key``
The activation key for the new account.
``expiration_days``
The number of days remaining during which the account may be
activated.
``site``
An object representing the site on which the user registered;
depending on whether ``django.contrib.sites`` is installed, this
may be an instance of either ``django.contrib.sites.models.Site``
(if the sites application is installed) or
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
documentation for the Django sites framework
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
details regarding these objects' interfaces.
``user``
The new user account
``request``
``HttpRequest`` instance for better flexibility.
For example it can be used to compute absolute register URL:
{{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %}
{% endcomment %}
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}
{% comment %}
**registration/activation_email_subject.txt**
Used to generate the subject line of the activation email. Because the
subject line of an email must be a single line of text, any output
from this template will be forcibly condensed to a single line before
being used. This template has the following context:
``activation_key``
The activation key for the new account.
``expiration_days``
The number of days remaining during which the account may be
activated.
``site``
An object representing the site on which the user registered;
depending on whether ``django.contrib.sites`` is installed, this
may be an instance of either ``django.contrib.sites.models.Site``
(if the sites application is installed) or
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
documentation for the Django sites framework
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
details regarding these objects' interfaces.
{% endcomment %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Approval Failure" %}{% endblock %}
{% block content %}
<p>{% trans "Account Approval failed." %}</p>
{% endblock %}
{% comment %}
**registration/admin_approve.html**
Used if account activation fails. With the default setup, has the following context:
``activation_key``
The activation key used during the activation attempt.
{% endcomment %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Account Approved" %}{% endblock %}
{% block content %}
<p>
{% trans "The user's account is now approved." %}
</p>
{% endblock %}
{% comment %}
**registration/admin_approve_complete.html**
Used after admin successfully approves a user's account. This template has no context
variables of its own, and should simply inform the admin that the user's
account is now active.
{% endcomment %}
{% load i18n %}
<!doctype html>
<html lang="en">
<head>
<title>{{ site.name }} {% trans "admin approval" %}</title>
</head>
<body>
<p>
{% blocktrans %}
Your account is now approved. You can
{% endblocktrans %}
<a href="http://{{site.domain}}{% url 'login' %}">{% trans "log in." %}</a>
</p>
</body>
</html>
{% comment %}
**registration/admin_approve_complete_email.html**
Used after successful account activation. This template has no context
variables of its own, and should simply inform the user that their
account is now active.
{% endcomment %}
{% load i18n %}
{% blocktrans %}
Your account is now approved. You can log in using the following link
{% endblocktrans %}
http://{{site.domain}}{% url 'login' %}
{% comment %}
**registration/admin_approve_complete_email.txt**
Used after successful account activation. This template has no context
variables of its own, and should simply inform the user that their
account is now active.
{% endcomment %}
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}
{% comment %}
**registration/admin_approve_complete_email_subject.txt**
Used to generate the subject line of the admin approval complete email. Because
the subject line of an email must be a single line of text, any output
from this template will be forcibly condensed to a single line before
being used. This template has the following context:
``site``
An object representing the site on which the user registered;
depending on whether ``django.contrib.sites`` is installed, this
may be an instance of either ``django.contrib.sites.models.Site``
(if the sites application is installed) or
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
documentation for the Django sites framework
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
details regarding these objects' interfaces.
{% endcomment %}
{% load i18n %}
<!doctype html>
<html lang="en">
<head>
<title>{{ site.name }} {% trans "registration" %}</title>
</head>
<body>
<p>
{% blocktrans with site_name=site.name %}
The following user ({{ user }}) has asked to register an account at
{{ site_name }}.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
To approve this, please
{% endblocktrans %}
<a href="http://{{site.domain}}{% url 'registration_admin_approve' profile_id %}"> {% trans "click here" %}</a>.
</p>
<p>
{% blocktrans with site_name=site.name %}
Sincerely,
{{ site_name }} Management
{% endblocktrans %}
</p>
</body>
</html>
\ No newline at end of file
{% load i18n %}
{% blocktrans with site_name=site.name %}
The following user ({{ user }}) has asked to register an account at
{{ site_name }}.
{% endblocktrans %}
{% blocktrans %}
To approve this, please click the following link.
{% endblocktrans %}
http://{{site.domain}}{% url 'registration_admin_approve' profile_id %}
\ No newline at end of file
{% load i18n %}{% trans "Account approval on" %} {{ site.name }}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Log in" %}{% endblock %}
{% block content %}
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Log in' %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<p>{% trans "Forgot your password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>.</p>
<p>{% trans "Not a member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>.</p>
{% endblock %}
{% comment %}
**registration/login.html**
It's your responsibility to provide the login form in a template called
registration/login.html by default. This template gets passed four
template context variables:
``form``
A Form object representing the login form. See the forms
documentation for more on Form objects.
``next``
The URL to redirect to after successful login. This may contain a
query string, too.
``site``
The current Site, according to the SITE_ID setting. If you don't
have the site framework installed, this will be set to an instance
of RequestSite, which derives the site name and domain from the
current HttpRequest.
``site_name``
An alias for site.name. If you don't have the site framework
installed, this will be set to the value of
request.META['SERVER_NAME']. For more on sites, see The
"sites" framework.
{% endcomment %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Logged out" %}{% endblock %}
{% block content %}
<p>{% trans "Successfully logged out" %}.</p>
{% endblock %}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password changed" %}{% endblock %}
{% block content %}
<p>{% trans "Password successfully changed!" %}</p>
{% endblock %}
{# This is used by django.contrib.auth #}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Change password" %}{% endblock %}
{% block content %}
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Change password' %}" />
</form>
{% endblock %}
{# This is used by django.contrib.auth #}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password reset complete" %}{% endblock %}
{% block content %}
<p>
{% trans "Your password has been reset!" %}
{% blocktrans %}You may now <a href="{{ login_url }}">log in</a>{% endblocktrans %}.
</p>
{% endblock %}
{# This is used by django.contrib.auth #}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Confirm password reset" %}{% endblock %}
{% block content %}
<p>{% trans "Enter your new password below to reset your password:" %}</p>
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Set password' %}" />
</form>
{% endblock %}
{# This is used by django.contrib.auth #}
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password reset" %}{% endblock %}