style

parent 01c7ab1b
Pipeline #377 passed with stage
in 11 seconds
......@@ -4,10 +4,10 @@ DB_NAME=manhattan
DB_USER=albert
DB_PASSWORD=einstein
DB_HOST=localhost
DJANGO_MANAGEPY_MIGRATE="on"
DJANGO_MANAGEPY_MIGRATE=on
# app
DJANGO_SECRET_KEY=s+s6-^@s&=xg@l7!qsprhd5-1-0*wuh*0tjm_5)%uq(5q(nc4c
DJANGO_SECRET_KEY="s+s6-^@s&=xg@l7!qsprhd5-1-0*wuh*0tjm_5)%uq(5q(nc4c"
# For debugging and error reporting
DEBUG=False
---
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python
image: python:3.7
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
# Check out:
# http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
#- mysql:latest
# - mysql:latest
- postgres:latest
variables:
......@@ -21,7 +23,7 @@ cache:
# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
- python3.7 -V # Print out python version for debugging
- python3.7 -V # Print out python version for debugging
# Uncomment next line if your Django app needs a JS runtime:
# - apt-get update -q && apt-get install nodejs -yqq
- cp manhattan_project/settings-sample.py manhattan_project/settings.py
......
Nuclear Blast icon by Arthur Shlain (CC by 3.0)
Proyecto Manhattan
==================
# Proyecto Manhattan
> First we take Manhattan, then we take Berlin.
Manhattan es una aplicación web para gestionar los proyectos de Innovación Docente.
Está desarrollada con [Django](https://www.djangoproject.com/) 2, mucho ♥, bastante ☕ y un poco de magia 🧙.
Requisitos
----------
## Requisitos
- Python 3.7 o superior. En Debian se puede instalar con el script `compile_python.sh`. En Ubuntu instalar los paquetes python3.7 libpython3.7-dev.
- [pip](https://pip.pypa.io/en/stable/installing/) (puede venir con la instalación de Python).
- [pipenv](https://github.com/pypa/pipenv) (se puede instalar con `sudo -H pip3 install pipenv`).
- Paquetes libxmlsec1-dev pkg-config
- Un SGBD aceptado por Django (vg PostgreSQL o MariaDB).
Para MariaDB/MySQL instalar el paquete libmariadbclient-dev o libmysqlclient-dev. La configuración deberá incluir:
- Python 3.7 o superior. En Debian se puede instalar con el script `compile_python.sh`. En Ubuntu instalar los paquetes python3.7 libpython3.7-dev.
- [pip](https://pip.pypa.io/en/stable/installing/) (puede venir con la instalación de Python).
- [pipenv](https://github.com/pypa/pipenv) (se puede instalar con `sudo -H pip3 install pipenv`).
- Paquetes libxmlsec1-dev pkg-config
- Un SGBD aceptado por Django (vg PostgreSQL o MariaDB).
Para MariaDB/MySQL instalar el paquete libmariadbclient-dev o libmysqlclient-dev. La configuración deberá incluir:
```ini
innodb_file_per_table
innodb_file_format = Barracuda
innodb_large_prefix
innodb_default_row_format = dynamic
```
```ini
innodb_file_per_table
innodb_file_format = Barracuda
innodb_large_prefix
innodb_default_row_format = dynamic
```
Instalación
-----------
## Instalación
```shell
cd manhattan
pipenv --python 3.7 install --dev
```
Configuración inicial
---------------------
## Configuración inicial
1. Configurar las bases de datos en el fichero `.env` y la sección `DATABASES` de `manhattan_project/settings.py`.
2. Configurar los datos para el correo, y la URL del sitio.
3. Configurar los datos para el _Single Sign On_ (SAML).
4. Ejecutar
```shell
pipenv shell
./manage.py migrate
./manage.py createsuperuser
./manage.py loaddata seed
```
```shell
pipenv shell
./manage.py migrate
./manage.py createsuperuser
./manage.py loaddata seed
```
Servidor web para desarrollo
----------------------------
## Servidor web para desarrollo
```shell
pipenv shell
......
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm, CustomUserChangeForm
from .forms import CustomUserChangeForm, CustomUserCreationForm
from .models import CustomUser
......
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import CustomUser
......
......@@ -2,43 +2,127 @@
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
dependencies = [("auth", "0009_alter_user_last_name_max_length")]
operations = [
migrations.CreateModel(
name='CustomUser',
name="CustomUser",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("password", models.CharField(max_length=128, verbose_name="password")),
(
"last_login",
models.DateTimeField(
blank=True, null=True, verbose_name="last login"
),
),
(
"is_superuser",
models.BooleanField(
default=False,
help_text="Designates that this user has all permissions without explicitly assigning them.",
verbose_name="superuser status",
),
),
(
"username",
models.CharField(
error_messages={
"unique": "A user with that username already exists."
},
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
max_length=150,
unique=True,
validators=[
django.contrib.auth.validators.UnicodeUsernameValidator()
],
verbose_name="username",
),
),
(
"first_name",
models.CharField(
blank=True, max_length=30, verbose_name="first name"
),
),
(
"last_name",
models.CharField(
blank=True, max_length=150, verbose_name="last name"
),
),
(
"email",
models.EmailField(
blank=True, max_length=254, verbose_name="email address"
),
),
(
"is_staff",
models.BooleanField(
default=False,
help_text="Designates whether the user can log into this admin site.",
verbose_name="staff status",
),
),
(
"is_active",
models.BooleanField(
default=True,
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
verbose_name="active",
),
),
(
"date_joined",
models.DateTimeField(
default=django.utils.timezone.now, verbose_name="date joined"
),
),
(
"groups",
models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
related_name="user_set",
related_query_name="user",
to="auth.Group",
verbose_name="groups",
),
),
(
"user_permissions",
models.ManyToManyField(
blank=True,
help_text="Specific permissions for this user.",
related_name="user_set",
related_query_name="user",
to="auth.Permission",
verbose_name="user permissions",
),
),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
"verbose_name": "user",
"verbose_name_plural": "users",
"abstract": False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
managers=[("objects", django.contrib.auth.models.UserManager())],
)
]
......@@ -5,59 +5,77 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
dependencies = [("accounts", "0001_initial")]
operations = [
migrations.AddField(
model_name='customuser',
name='centro_id_nks',
field=models.CharField(blank=True, max_length=127, null=True, verbose_name='Cód. centros'),
model_name="customuser",
name="centro_id_nks",
field=models.CharField(
blank=True, max_length=127, null=True, verbose_name="Cód. centros"
),
),
migrations.AddField(
model_name='customuser',
name='colectivos',
model_name="customuser",
name="colectivos",
field=models.CharField(blank=True, max_length=127, null=True),
),
migrations.AddField(
model_name='customuser',
name='departamento_id_nks',
field=models.CharField(blank=True, max_length=127, null=True, verbose_name='Cód. departamentos'),
model_name="customuser",
name="departamento_id_nks",
field=models.CharField(
blank=True, max_length=127, null=True, verbose_name="Cód. departamentos"
),
),
migrations.AddField(
model_name='customuser',
name='last_name_2',
field=models.CharField(blank=True, max_length=150, null=True, verbose_name='segundo apellido'),
model_name="customuser",
name="last_name_2",
field=models.CharField(
blank=True, max_length=150, null=True, verbose_name="segundo apellido"
),
),
migrations.AddField(
model_name='customuser',
name='nombre_oficial',
model_name="customuser",
name="nombre_oficial",
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='customuser',
name='numero_documento',
field=models.CharField(blank=True, help_text='DNI, NIE o pasaporte.', max_length=16, null=True, verbose_name='número de documento'),
model_name="customuser",
name="numero_documento",
field=models.CharField(
blank=True,
help_text="DNI, NIE o pasaporte.",
max_length=16,
null=True,
verbose_name="número de documento",
),
),
migrations.AddField(
model_name='customuser',
name='sexo',
model_name="customuser",
name="sexo",
field=models.CharField(blank=True, max_length=1, null=True),
),
migrations.AddField(
model_name='customuser',
name='sexo_oficial',
model_name="customuser",
name="sexo_oficial",
field=models.CharField(blank=True, max_length=1, null=True),
),
migrations.AddField(
model_name='customuser',
name='tipo_documento',
field=models.CharField(blank=True, help_text='DNI, NIE o pasaporte.', max_length=3, null=True, verbose_name='tipo de documento'),
model_name="customuser",
name="tipo_documento",
field=models.CharField(
blank=True,
help_text="DNI, NIE o pasaporte.",
max_length=3,
null=True,
verbose_name="tipo de documento",
),
),
migrations.AlterField(
model_name='customuser',
name='first_name',
field=models.CharField(blank=True, max_length=50, verbose_name='first name'),
model_name="customuser",
name="first_name",
field=models.CharField(
blank=True, max_length=50, verbose_name="first name"
),
),
]
import json
from django.contrib.auth.models import AbstractUser, UserManager
from django.db import models
from django.utils.translation import gettext_lazy as _
......
import json
from django.db import connections
......
from django.test import TestCase
# Create your tests here.
---
version: "3.7"
services:
web:
......@@ -13,3 +14,4 @@ services:
restart: on-failure
volumes:
- ./media:/code/media:rw
...
......@@ -7,4 +7,4 @@ if [ "x$DJANGO_MANAGEPY_MIGRATE" = 'xon' ]; then
python manage.py migrate --noinput
fi
exec "$@"
\ No newline at end of file
exec "$@"
from django.contrib import admin
# Register your models here.
......@@ -2,4 +2,4 @@ from django.apps import AppConfig
class IndoConfig(AppConfig):
name = 'indo'
name = "indo"
from accounts.models import CustomUser
from accounts.pipeline import UsuarioNoEncontrado, get_identidad
from django import forms
from django.utils.translation import gettext_lazy as _
from social_django.models import UserSocialAuth
from social_django.utils import load_strategy
from .models import ParticipanteProyecto, Proyecto, TipoParticipacion
from accounts.models import CustomUser as CustomUser
from accounts.pipeline import get_identidad, UsuarioNoEncontrado
class InvitacionForm(forms.ModelForm):
......
This diff is collapsed.
This diff is collapsed.
# Generated by Django 2.2.1 on 2019-05-31 12:56
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
......
# Generated by Django 2.2.1 on 2019-06-06 12:12
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
......
# Generated by Django 2.2.1 on 2019-06-11 08:19
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
......
import urllib.parse
from django import template
from django.urls import reverse
from django.utils.safestring import mark_safe
register = template.Library()
# DEFAULT_TAGS defined in django.contrib.messages.constants
......
from django.test import SimpleTestCase
from django.urls import resolve, reverse
from .views import HomePageView
......
......@@ -17,6 +17,7 @@ from .views import (
ProyectosUsuarioView,
)
urlpatterns = [
path("", HomePageView.as_view(), name="home"),
path("summernote/", include("django_summernote.urls")),
......
import json
import pypandoc
from datetime import date
import pypandoc
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
......@@ -12,9 +13,8 @@ from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView, RedirectView, TemplateView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django_summernote.widgets import SummernoteWidget
from templated_email import send_templated_mail
from .forms import InvitacionForm, ProyectoForm
......
......@@ -2,8 +2,9 @@
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'manhattan_project.settings')
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "manhattan_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
......
......@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
import os
from datetime import date
from django.urls import reverse_lazy
......
......@@ -15,10 +15,11 @@ Including another URLconf
"""
from django.contrib import admin
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import path, include
from django.urls import include, path
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", include("accounts.urls")),
......
......@@ -11,6 +11,7 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'manhattan_project.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "manhattan_project.settings")
application = get_wsgi_application()
Copyright (c) 2010-2015, Łukasz Dziedzic (dziedzic@typoland.com),
with Reserved Font Name Lato.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining