Compare commits
4 Commits
b4344d31a8
...
fix/relati
Author | SHA1 | Date | |
---|---|---|---|
48e98cbfc3
|
|||
|
6739e997bc | ||
33cd9c202e | |||
efcab93460 |
11
README.md
11
README.md
@@ -10,12 +10,21 @@ Install python and pip on local machine
|
||||
pip install virtualenv
|
||||
python -m venv venv #/path/to/new/virtual/environment
|
||||
source venv/bin/activate #activate virtual env
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirments.txt
|
||||
python3 ./init_db.py #initialize database
|
||||
|
||||
python3 ./run.py #run project
|
||||
```
|
||||
|
||||
# On database changes
|
||||
|
||||
Delete file `/instance/taskmanager.db`
|
||||
And reinit the db
|
||||
|
||||
```shell
|
||||
python3 ./init_db.py
|
||||
```
|
||||
|
||||
# Build app
|
||||
|
||||
```bash
|
||||
|
@@ -1,10 +1,14 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
from flask import render_template, request, redirect
|
||||
|
||||
from taskmanager import app, db
|
||||
from taskmanager.functions import *
|
||||
from taskmanager.models import *
|
||||
import configparser
|
||||
|
||||
CONFIG_PATH = "/var/taskmanager/taskmanager/config.ini"
|
||||
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
CONFIG_PATH = os.path.join(PROJECT_PATH, "config.ini")
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
@@ -25,7 +29,7 @@ def addtask():
|
||||
username = request.form['username']
|
||||
# Input sanitation
|
||||
# Task name
|
||||
if not taskname.isprintable():
|
||||
if not taskname.printable() or ("<" in taskname and ">" in taskname):
|
||||
return render_template('pages/response.html', response = "Task name has to be made only of letters or numbers.")
|
||||
if len(taskname) < 1 or len(taskname) > 40:
|
||||
return render_template('pages/response.html', response = "Task name lenght invalid, only smaller then 40 charachters allowed")
|
||||
@@ -43,7 +47,7 @@ def addtask():
|
||||
|
||||
# Task descripton
|
||||
if taskdesc != '':
|
||||
if not taskdesc.isprintable():
|
||||
if not taskdesc.isprintable() or ("<" in taskdesc and ">" in taskdesc):
|
||||
return render_template('pages/response.html', response = "Task description has to be made of printable characters.")
|
||||
if len(taskdesc) > 2000:
|
||||
return render_template('pages/response.html', response = "Task description lenght invalid, only smaller then 2000 charachters allowed")
|
||||
@@ -72,7 +76,7 @@ def register():
|
||||
|
||||
# Contact
|
||||
if contact != '':
|
||||
if not contact.isprintable():
|
||||
if not contact.isprintable() or ("<" in contact and ">" in contact):
|
||||
return render_template('pages/response.html', response = "Contact information has to be made of printable characters.")
|
||||
if len(contact) > 100:
|
||||
return render_template('pages/response.html', response = "Contact lenght invalid, only smaller then 100 charachters allowed")
|
||||
|
@@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Add new task</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li class="current"><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-addtask">
|
||||
<h1>Create new task</h1>
|
||||
<div class="form-wrap">
|
||||
<form action="/addtask" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="taskname" class="label">Task name:</label>
|
||||
<input type="text" name="taskname" id="taskname" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="taskdesc" class="label">Description:</label>
|
||||
<input type="text" name="taskdesc" id="taskdesc" placeholder="optional"/>
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="username" class="label">Username:</label>
|
||||
<input type="text" name="username" id="username" placeholder="optional"/>
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Delete task</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li class="current"><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-addtask">
|
||||
<h1>Create new task</h1>
|
||||
<div class="form-wrap">
|
||||
<form action="/projects/{{task.id}}/del" method="POST">
|
||||
<p> Task creator's password <p>
|
||||
<div class="form-input">
|
||||
<label for="password" class="label">password:</label>
|
||||
<input type="password" name="password" id="password" required />
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">DELETE</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@@ -1,39 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Task manager</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li class="current"><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-index">
|
||||
<section>
|
||||
<div class="btn">
|
||||
<a href="/addtask">Add new task</a>
|
||||
</div>
|
||||
<div class="tasks-wrap">
|
||||
<h1>Tasks</h1>
|
||||
{% for task in tasks %}
|
||||
<div class="task">
|
||||
<a href="/projects/{{task.id}}">
|
||||
<div>{{task.id}}.</div>
|
||||
<div>{{task.name}}</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@@ -1,54 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>{{task.name}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-project">
|
||||
<section >
|
||||
<h1>{{task.name}}</h1>
|
||||
<label class="label underline">Description</label>
|
||||
<p>{{task.desc}}</p>
|
||||
</section>
|
||||
<section class="section-task">
|
||||
<div>
|
||||
<label class="label underline">Users added to this task</label>
|
||||
{% for user in users %}
|
||||
<div class="user-info-wrap">
|
||||
<div><b>Username:</b> {{user.username}}</div>
|
||||
<div><b>Contact info:</b> {{user.contact}}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
<label class="label underline"> Add person to task</label>
|
||||
<div class="form-wrap">
|
||||
<form action="/projects/{{task.id}}" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="username" class="label">Username:</label>
|
||||
<input type="text" name="username" id="username" required />
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
<p><a href="/projects/{{task.id}}/del">DELETE TASK</a><p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Register</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li class="current"><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-register">
|
||||
<div class="form-wrap">
|
||||
<form action="/register" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" name="username" id="username" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="contact">Contact:</label>
|
||||
<input type="text" name="contact" id="contact" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" name="password" placeholder="optional" id="password"/>
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Task Manager</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-project">
|
||||
<section >
|
||||
<p>{{response}}<p>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user