Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 2522c504 authored by Timothée Mazzucotelli's avatar Timothée Mazzucotelli
Browse files

Merge branch '2-move-code-from-cookiecutter' into 'master'

Resolve "Move code from cookiecutter / hope" (#2)

See merge request !2
parents 79dbee85 80589339
Pipeline #1583 passed with stages
in 6 minutes and 3 seconds
......@@ -4,172 +4,61 @@ stages:
- build
- deploy
py27-django18:
image: python:2.7
stage: test
before_script:
- pip install tox
script: tox -e py27-django18
py34-django18:
image: python:3.4
stage: test
before_script:
- pip install tox
script: tox -e py34-django18
py35-django18:
image: python:3.5
stage: test
before_script:
- pip install tox
script: tox -e py35-django18
py36-django18:
image: python:3.6
stage: test
before_script:
- pip install tox
script: tox -e py36-django18
py37-django18:
image: python:3.7-rc-stretch
stage: test
before_script:
- pip install tox
script: tox -e py37-dev-django18
py27-django19:
image: python:2.7
stage: test
before_script:
- pip install tox
script: tox -e py27-django19
py34-django19:
image: python:3.4
stage: test
before_script:
- pip install tox
script: tox -e py34-django19
py35-django19:
image: python:3.5
stage: test
before_script:
- pip install tox
script: tox -e py35-django19
py36-django19:
image: python:3.6
stage: test
before_script:
- pip install tox
script: tox -e py36-django19
py37-django19:
image: python:3.7-rc-stretch
stage: test
before_script:
- pip install tox
script: tox -e py37-dev-django19
py27-django110:
image: python:2.7
stage: test
before_script:
- pip install tox
script: tox -e py27-django110
py34-django110:
py34-django111:
image: python:3.4
stage: test
before_script:
- pip install tox
script: tox -e py34-django110
script: tox -e py34-django111
py35-django110:
py35-django111:
image: python:3.5
stage: test
before_script:
- pip install tox
script: tox -e py35-django110
script: tox -e py35-django111
py36-django110:
py36-django111:
image: python:3.6
stage: test
before_script:
- pip install tox
script: tox -e py36-django110
script: tox -e py36-django111
py37-django110:
py37-django111:
image: python:3.7-rc-stretch
stage: test
before_script:
- pip install tox
script: tox -e py37-dev-django110
py27-django111:
image: python:2.7
stage: test
before_script:
- pip install tox
script: tox -e py27-django111
script: tox -e py37-dev-django111
py34-django111:
py34-django20:
image: python:3.4
stage: test
before_script:
- pip install tox
script: tox -e py34-django111
script: tox -e py34-django20
py35-django111:
py35-django20:
image: python:3.5
stage: test
before_script:
- pip install tox
script: tox -e py35-django111
script: tox -e py35-django20
py36-django111:
py36-django20:
image: python:3.6
stage: test
before_script:
- pip install tox
script: tox -e py36-django111
script: tox -e py36-django20
py37-django111:
py37-django20:
image: python:3.7-rc-stretch
stage: test
before_script:
- pip install tox
script: tox -e py37-dev-django111
script: tox -e py37-dev-django20
......
django-app-settings==0.2.5
django-cerberus-ac==0.2.1
-r base.txt
pytest
pytest-travis-fold
pytest-cov
pytest-django
django-fake-model
......@@ -25,6 +25,7 @@ try:
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'cerberus_ac',
'hope',
],
SITE_ID=1,
......
......@@ -56,7 +56,6 @@ setup(
# 'Framework :: Django :: 1.10',
# 'Framework :: Django :: 1.11',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
......@@ -68,7 +67,7 @@ setup(
'django-hope',
],
install_requires=[
# eg: 'aspectlib==1.1.1', 'six>=1.7',
'django-cerberus-ac'
],
extras_require={
# eg:
......
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import User
class SignUpForm(UserCreationForm):
email = forms.EmailField(label='Email', max_length=254)
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2', )
from django.db import models
from django.contrib.auth.models import AbstractUser
from cerberus_ac.models import RoleMixin
class User(AbstractUser, RoleMixin):
email_confirmed = models.BooleanField(default=False)
html, body {
height: 100%;
}
.container-fluid {
height: 100%;
}
{
"name": "static",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"bootstrap": "^3.3.7",
"jquery": "^3.2.1"
}
}
{% autoescape off %}
Hi {{ user.username }},
Please click on the link below to confirm your registration:
http://{{ domain }}{% url 'activate' uidb64=uid token=token %}
{% endautoescape %}
{% extends "base.html" %}
{% block content %}
An email has been sent to the specified email address.
Please click on the link inside the email to activate your account.
{% endblock %}
{% load i18n static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
{# <link rel="icon" href="../../favicon.ico">#}
<title>
{% block title %}{{cookiecutter.package_name}}{% endblock %}
</title>
<!-- Bootstrap core CSS -->
<link href="{% static "node_modules/bootstrap/dist/css/bootstrap.min.css" %}" rel="stylesheet">
<!-- Custom CSS -->
<link href="{% static "css/base.css" %}" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<!-- Static navbar -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url "home" %}">HOPE</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="{% block navbar_home %}{% endblock %}"><a href="{% url "home" %}">Home</a></li>
<li class="{% block navbar_about %}{% endblock %}"><a href="{% url "about" %}">About</a></li>
<li class="{% block navbar_contact %}{% endblock %}"><a href="{% url "contact" %}">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
{% block content %}
{% endblock %}
</div> <!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="{% static "node_modules/jquery/dist/jquery.min.js" %}"></script>
<script src="{% static "node_modules/bootstrap/dist/js/bootstrap.min.js" %}"></script>
</body>
</html>
{% extends 'base.html' %}
{% block title %}Hope{% endblock %}
{% block navbar_home %}active{% endblock %}
{% block content %}
<div class="jumbotron">
<h1>Welcome to Hope</h1>
<p>(Put Hope description here)</p>
{% if not user.is_authenticated %}
<a class="btn btn-default" href="{% url "signin" %}">Sign-in</a>
<a class="btn btn-success" href="{% url "signup" %}">Sign-up</a>
{% else %}
<a class="btn btn-primary" href="{% url "signout" %}">Sign-out</a>
{% endif %}
</div>
{% endblock %}
{% extends 'base.html' %}
{% load bootstrap %}
{% block title %}Sign in{% endblock %}
{% block content %}
<h2>Login</h2>
<form class="form form-vertical" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<div class="form-group">
<button type="submit" class="btn btn-primary">Sign-in</button>
</div>
</form>
{% endblock %}
{% extends 'base.html' %}
{% block title %}Signed out{% endblock %}
{% block content %}
<h2>Yo have been signed out.</h2>
{% endblock %}
{% extends 'base.html' %}
{% load bootstrap %}
{% block title %}Sign up{% endblock %}
{% block content %}
<h2>Sign up</h2>
<form class="form form-vertical" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<div class="form-group">
<button type="submit" class="btn btn-primary">Sign-up</button>
</div>
</form>
{% endblock %}
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils import six
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self, user, timestamp):
return (
six.text_type(user.pk) + six.text_type(timestamp) +
six.text_type(user.email_confirmed)
)
account_activation_token = AccountActivationTokenGenerator()
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
url(r'^signup/$', views.signup, name='signup'),
url(r'^signin/$', auth_views.login,
{'template_name': 'hope/signin.html'}, name='signin'),
url(r'^signout/$', auth_views.logout,
{'template_name': 'hope/signout.html'}, name='signout'),
url(r'^account_activation_sent/$',
views.account_activation_sent, name='account_activation_sent'),
url(r'^activate/'
r'(?P<uidb64>[0-9A-Za-z_\-]+)/'
r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
views.activate, name='activate')
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment