Commit 4d7a1f33 authored by Aljaž Srebrnič's avatar Aljaž Srebrnič

Initial commit

This contains the base flask skeleton with a main page and the new
member registration form.
parents
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
graft m_ship/static
graft m_ship/templates
global-exclude *.pyc
\ No newline at end of file
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
flask = "*"
flask-assets = "*"
libsass = "*"
cssmin = "*"
[dev-packages]
[requires]
python_version = "3.7"
{
"_meta": {
"hash": {
"sha256": "23b7b20289d4dbb7048bfbed7b5c024c155e7e73823ec2da0802e8449f0210d6"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"click": {
"hashes": [
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
"sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
],
"version": "==7.0"
},
"cssmin": {
"hashes": [
"sha256:e012f0cc8401efcf2620332339011564738ae32be8c84b2e43ce8beaec1067b6"
],
"index": "pypi",
"version": "==0.2.0"
},
"flask": {
"hashes": [
"sha256:2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48",
"sha256:a080b744b7e345ccfcbc77954861cb05b3c63786e93f2b3875e0913d44b43f05"
],
"index": "pypi",
"version": "==1.0.2"
},
"flask-assets": {
"hashes": [
"sha256:6031527b89fb3509d1581d932affa5a79dd348cfffb58d0aef99a43461d47847"
],
"index": "pypi",
"version": "==0.12"
},
"itsdangerous": {
"hashes": [
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
"sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
],
"version": "==1.1.0"
},
"jinja2": {
"hashes": [
"sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd",
"sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
],
"version": "==2.10"
},
"libsass": {
"hashes": [
"sha256:2313f0e82de034eea59443c8f69420c60c55f7c07fd3b59ea7e7a108b36e9d86",
"sha256:81d63f915d12bbff9931beac3eb6e20c17c40a0da06c3f0173bbacd6568c302c",
"sha256:8731fb9b4d3151b82d46a4495c8e2b322705cacbcb963c4bfe51d8a5a0c016e7",
"sha256:938518d827905c83d774a190cc6257b8183edea577485c20de7d49af5ccbeea6",
"sha256:95109c996ea5cf598344971e7c50847930f1d5dc110b4fc989c047d3b63c0c92",
"sha256:99d952ac9315af4494eedb1c38e13a16c7c49a6ca056262353e9433f086a1fe3",
"sha256:9c87df48b541276cc8b03316ab558b4019f16e158786923950926a6ce756124a",
"sha256:9f740659ec137cafbfd2298e77f21ceb1e40d30c578bd047e55e09da9220048e",
"sha256:a1315327c134d5ec8f90b4185e1ff2369be0108733f1be0c2ae8ba629c514ef1",
"sha256:bcbbb4fdd3117e00dc43594fe7e3b10fe17ada8932734287b2680fca18e118c9",
"sha256:daa7ea2b3b24585cff907320d071992ffea3ba36c4523f90798f27d1c4a9ef66",
"sha256:e0046d841469df8f578d7bbeb6859502cd4b09b9d559451a35392256423559ea",
"sha256:e39800d946b9b11d956f02e158eeb85b86ae5b801e63c335f83609d2811b643a"
],
"index": "pypi",
"version": "==0.15.1"
},
"markupsafe": {
"hashes": [
"sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
],
"version": "==1.0"
},
"six": {
"hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
],
"version": "==1.11.0"
},
"webassets": {
"hashes": [
"sha256:e7d9c8887343123fd5b32309b33167428cb1318cdda97ece12d0907fd69d38db"
],
"version": "==0.12.1"
},
"werkzeug": {
"hashes": [
"sha256:c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c",
"sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b"
],
"version": "==0.14.1"
}
},
"develop": {}
}
# Mittelab Membership platform
This is a membership panel. The main features are:
- Accepting new membership requests
- Managing an existing membership
- Payment status
- Special privileges (door open)
- Multilanguage!
# Technologies used
- Python Flask
- HTML5 + CSS3
- Tryton
- FreeIPA
# Pages
## Welcome page
Explain what the website is and how can be used. Two jumbotrons will lead the users toward:
- Registration of a new member
- Login via Ipsilon and membership panel
## Registration form
A "standard" registration form. Has to have links to statute and rules as HTML, checkboxes to read & accept.
import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile('config.py', silent=True)
else:
# load the test config if passed in
app.config.from_mapping(test_config)
# ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
from flask_assets import Environment, Bundle
app = Flask(__name__)
assets = Environment(app)
css = Bundle('css/style.scss', filters='libsass,cssmin', output='style.css', depends='css/**/*.scss')
assets.register('css_all', css)
from . import main
app.register_blueprint(main.bp)
app.add_url_rule('/', endpoint='index')
return app
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
bp = Blueprint('main', __name__)
@bp.route('/')
def index():
return render_template('main/index.html')
@bp.route('/new')
def new():
return render_template('main/new.html')
$mittelab-green: #0ce3ac;
$mittelab-blue: #375a7f;
$mittelab-logo: #7fc0c2;
$mittelab-primary: #fff;
$mittelab-secondary: #222;
$mittelab-tertiary: #0ce3ac;
$mittelab-quandary: #0ce3ac;
$mittelab-header-background: #375a7f;
$mittelab-header-primary: #fff;
$mittelab-highlight: #428bca;
$mittelab-danger: #b00b1e;
$mittelab-success: #44ff00;
$mittelab-love: #fa6c8d;
\ No newline at end of file
/*
* Globals
*/
@import "mittelab";
/* Links */
a,
a:focus,
a:hover {
color: $mittelab-green;
}
/* Custom default button */
.btn-secondary,
.btn-secondary:hover,
.btn-secondary:focus {
color: $mittelab-secondary;
text-shadow: none; /* Prevent inheritance from `body` */
background-color: $mittelab-primary;
border: .05rem solid $mittelab-primary;
}
.btn-primary,
.btn-primary:hover,
.btn-primary:focus {
color: $mittelab-primary;
background-color: $mittelab-blue;
border: .05rem solid $mittelab-blue;
}
.color-loving {
color: $mittelab-love;
}
/*
* Base structure
*/
html,
body {
height: 100%;
background-color: $mittelab-secondary;
}
body {
display: -ms-flexbox;
display: flex;
color: $mittelab-primary;
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
box-shadow: inset 0 0 5rem rgba(0, 0, 0, .5);
}
.cover-container {
max-width: 56em;
}
/*
* Header
*/
.masthead {
margin-bottom: 2rem;
}
.masthead-brand {
margin-bottom: 0;
}
.nav-masthead .nav-link {
padding: .25rem 0;
font-weight: 700;
color: rgba(255, 255, 255, .5);
background-color: transparent;
border-bottom: .25rem solid transparent;
}
.nav-masthead .nav-link:hover,
.nav-masthead .nav-link:focus {
border-bottom-color: rgba(255, 255, 255, .25);
}
.nav-masthead .nav-link + .nav-link {
margin-left: 1rem;
}
.nav-masthead .active {
color: #fff;
border-bottom-color: #fff;
}
@media (min-width: 48em) {
.masthead-brand {
float: left;
}
.nav-masthead {
float: right;
}
}
/*
* Cover
*/
.cover {
padding: 0 1.5rem;
}
.cover .btn-lg {
padding: .75rem 1.25rem;
font-weight: 700;
}
/*
* Footer
*/
.mastfoot {
color: rgba(255, 255, 255, .5);
}
a,a:focus,a:hover{color:#0ce3ac}.btn-secondary,.btn-secondary:hover,.btn-secondary:focus{color:#222;text-shadow:none;background-color:#fff;border:.05rem solid #fff}.btn-primary,.btn-primary:hover,.btn-primary:focus{color:#fff;background-color:#375a7f;border:.05rem solid #375a7f}.color-loving{color:#fa6c8d}html,body{height:100%;background-color:#222}body{display:-ms-flexbox;display:flex;color:#fff;text-shadow:0 .05rem .1rem rgba(0,0,0,0.5);box-shadow:inset 0 0 5rem rgba(0,0,0,0.5)}.cover-container{max-width:56em}.masthead{margin-bottom:2rem}.masthead-brand{margin-bottom:0}.nav-masthead .nav-link{padding:.25rem 0;font-weight:700;color:rgba(255,255,255,0.5);background-color:transparent;border-bottom:.25rem solid transparent}.nav-masthead .nav-link:hover,.nav-masthead .nav-link:focus{border-bottom-color:rgba(255,255,255,0.25)}.nav-masthead .nav-link+.nav-link{margin-left:1rem}.nav-masthead .active{color:#fff;border-bottom-color:#fff}@media(min-width:48em){.masthead-brand{float:left}.nav-masthead{float:right}}.cover{padding:0 1.5rem}.cover .btn-lg{padding:.75rem 1.25rem;font-weight:700}.mastfoot{color:rgba(255,255,255,0.5)}
\ No newline at end of file
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
{% assets "css_all" %}
<link rel="stylesheet" href="{{ ASSET_URL }}" />
{% endassets %}
{% block extra_headers %}{% endblock %}
<title>{% block title %}{% endblock %} - m-ship</title>
</head>
<body>
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<header class="masthead mb-auto">
<div class="inner">
<h3 class="masthead-brand">m-ship</h3>
<nav class="nav nav-masthead justify-content-center">
<a class="nav-link active" href="#">Home</a>
<a class="nav-link" href="#">Pannello</a>
<a class="nav-link" href="#">Contattaci</a>
</nav>
</div>
</header>
{% block content %}{% endblock %}
<footer class="mastfoot mt-auto">
<div class="inner">
<p>m-ship, copyleft Mittelab 2018, all rights reversed</p>
</div>
</footer>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Benvenuti{% endblock %}
{% block content %}
<main role="main" class="inner cover">
<h1 class="cover-heading">Benvenuti su m-ship!</h1>
<div class="row">
<div class="col-md">
<p class="lead">Vuoi diventare socio Mittelab?</p>
<p>Sei nel posto giusto! Un paio di domande e potrai finalizzare la tua richiesta di associazione.</p>
<p class="lead">
<a href="{{ url_for('.new') }}" class="btn btn-lg btn-primary">Diventa socio</a>
</p>
</div>
<div class="col-md">
<p class="lead">Sei già socio?</p>
<p>Effettua il login per controllare e modificare i tuoi dati personali e controllare i pagamenti delle quote.</p>
<p class="lead">
<a href="#" class="btn btn-lg btn-secondary">Log in</a>
</p>
</div>
</div>
</main>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}New membership{% endblock %}
{% block content %}
<main class="container">
<h1 class="color-loving">Benvenuto, nuovo socio!</h1>
<p>
Hai scelto di far parte della famiglia Mittelab! Prima di mandare la tua richiesta di associazione, abbiamo bisogno di alcune informazioni.
</p>
<form method="post">
<fieldset>
<legend>I tuoi dati personali</legend>
<div class="form-row">
<div class="form-group col">
<label for="inputName">Nome</label>
<input type="text" name="inputName" id="inputName" class="form-control" placeholder="Tizio">
</div>
<div class="form-group col">
<label for="inputSurname">Cognome</label>
<input type="text" name="inputSurname" id="InputSurname" class="form-control" placeholder="Caio">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="InputBirthDate">Data di nascita</label>
<input type="date" name="inputBirthDate" id="inputBirthDate" class="form-control" placeholder="">
</div>
<div class="form-group col-md-5">
<label for="inputBirthPlace">Luogo di nascita</label>
<input type="text" name="inputBirthPlace" id="inputBirthPlace" class="form-control" placeholder="">
</div>
<div class="form-group col-md-4">
<label for="inputFiscalCode">Codice Fiscale</label>
<input type="text" name="inputFiscalCode" id="inputFiscalCode" class="form-control" minlength="16" maxlength="16" placeholder="">
</div>
</div>
</fieldset>
<fieldset>
<legend>Dove abiti?</legend>
<div class="form-row">
<div class="form-group col-md-10">
<label for="inputAddress">Indirizzo</label>
<input type="text" class="form-control" id="inputAddress" placeholder="Via dei Matti">
</div>
<div class="form-group col-md-2">
<label for="inputNumber">N&ordm;</label>
<input type="text" class="form-control" id="inputNumber" placeholder="28">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<label for="inputZip">C.A.P.</label>
<input type="text" class="form-control" id="inputZip">
</div>
<div class="form-group col-md-6">
<label for="inputCity">Città</label>
<input type="text" class="form-control" id="inputCity">
</div>
<div class="form-group col-md-4">
<label for="inputState">Stato</label>
<select id="inputState" class="form-control">
<option selected>Choose...</option>
<option>...</option>
</select>
</div>
</div>
</fieldset>
<fieldset>
<legend>Come possiamo contattarti?</legend>
<div class="form-row">
<div class="form-group col">
<label for="inputTelephone">Telefono</label>
<input type="tel"
name="inputTelephone" id="inputTelephone" class="form-control" placeholder=""
aria-describedby="helpTelephone">
<small id="helpTelephone" class="text-muted">Il numero di delefono dove possiamo contattarti</small>
</div>
<div class="form-group col">
<label for="inputEmail">E-mail</label>
<input type="email" name="inputEmail" id="inputEmail" class="form-control" placeholder="me@mittelab.org">
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="inputUsername">Username desiderato</label>
<input type="text" name="inputUsername" id="inputUsername" class="form-control" placeholder="t1z10">
<small id="usernameHelp" class="form-text text-muted">L'username che vuoi usare nell'infrastruttura Mittelab.</small>
</div>
</div>
<div class="form-check">
<label class="form-check-label text-justify" for="inputPrivacy">
<input type="checkbox" class="form-check-input" name="inputPrivacy" id="inputPrivacy">
Dichiaro di acconsentire al trattamento dei dati personali ad esclusivo uso interno
della stessa. Qualora il sottoscritto/a desiderasse avere accesso a questi dati per chiederne la
modifica, la cancellazione o per opporsi al loro utilizzo potrà farlo senza ostruzione alcuna
(D.Lgs. 196/2003).
</label>
<small id="helpPrivacy" class="text-muted">
Senza il tuo consenso al trattamento dei dati non possiamo accettarti come socio!
</small>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" name="inputStatute" id="inputStatute"
value="statuteAccepted">
Dichiaro di aver preso visione dello statuto e del regolamento interno.
</label>
</div>
</fieldset>
<button type="submit" class="btn btn-lg btn-primary">Diventa socio</button>
</form>
</main>
{% endblock %}
from setuptools import find_packages, setup
setup(
name='m_ship',
version='1.0.0',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=[
'flask',
],
)
\ No newline at end of file
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