Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tasks/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from django.forms import ModelForm
from django import forms
from .models import Task

class TaskForm(ModelForm):
class TaskForm(forms.ModelForm):
class Meta:
model = Task
fields = ['title', 'description', 'important']
fields = ['title', 'description', 'important']
widgets = {
'title': forms.TextInput(attrs={'class':'form-control','placeholder':'Escriba el titulo'}),
'description': forms.Textarea(attrs={'class':'form-control','placeholder':'Escriba la descripcion'}),
'important': forms.CheckboxInput(attrs={'class':'form-check-input m-auto'}),
}
4 changes: 2 additions & 2 deletions tasks/templates/_navbar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="/">Navbar</a>
<a class="navbar-brand" href="/">OM Industrias</a>
<button
class="navbar-toggler"
type="button"
Expand All @@ -20,7 +20,7 @@
{% if user.is_authenticated %}
<li class="nav-item">
<a href="{% url 'tasks_completed' %}" class="nav-link"
>complted tasks</a
>completed tasks</a
>
</li>
<li class="nav-item">
Expand Down
22 changes: 15 additions & 7 deletions tasks/templates/create_task.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@

{% block content %}

<h1>CReate task</h1>
<main class="container">
<div class="row">
<div class="col-md-4 offet-md-4 mt-5">
<form action="/create_task/" method="POST" class="card card-body">
<h1>Create task</h1>
{{error}}
{% csrf_token %}
{{form}}
<button class="btn btn-primary">
Save
</button>
</form>

{{error}}
<form action="/create_task/" method="POST">
{% csrf_token %}
{{form}}
</div>
</div>
</main>

<button>Save</button>
</form>
{% endblock %}
25 changes: 20 additions & 5 deletions tasks/templates/home.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{% extends 'base.html' %} {% block content %}
{% extends 'base.html' %}
{% block content %}

<div class="container">
<h1>Home</h1>
</div>
<main class="container py-5">
<section class="card card-body">
<h1 class="display-1 text-center">Sistema Operaciones</h1>
<p>
sistema OM Industry
</p>
<div class="text-center">
<a class="btn btn-primary" href="/signin/">
signin
</a>
<a class="btn btn-primary" href="/signup/">
signup
</a>

{% endblock %}
</div>
</section>

</main>
{% endblock %}
37 changes: 26 additions & 11 deletions tasks/templates/signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@

{% block content %}

<h1>Signin</h1>
<main class="container">
<div class="row">

<section class="col-md-4 offset-md-4 mt-5">
<form action="/signin/" method="POST" class="card card-body">
{{error}}
{% csrf_token %}
<h1 class="text-center">Signup</h1>
{{error}}
{% csrf_token %}
<div class="mb-3">
<label for="Nombre Usuario"> Username:</label>
<input type="text" name="username" id="username" class="form-control"
placeholder="Escriba su Nombre de Usuario">
</div>
<div class="mb-3">
<label for="password"> Password:</label>
<input type="password" name="password" id="password" class="form-control"
placeholder="Escriba su Password">
</div>
<button class="btn btn-primary">Signin</button>

</form>

<p>
{{error}}
</p>

<form action="/signin/" method="POST">
{% csrf_token %}
{{form.as_p}}
<button>
Signin
</button>
</form>
</section>
</div>

</main>
{% endblock %}
41 changes: 28 additions & 13 deletions tasks/templates/signup.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
{% extends 'base.html' %} {% block content %}

<div class="container">
<h1>Signup</h1>

{{error}}

<form action="/signup/" method="POST">
{% csrf_token %} {{form.as_p}}
<button class="btn btn-primary">Signup</button>
</form>
</div>
{% endblock %}
{% extends 'base.html' %}
{% block content %}
<main class="container">
<div class="row">
<div class="col-md-4 offset-md-4 mt-5">
<form method="POST" class="card card-body">
<h1 class="text-center">Signup</h1>
{{error}}
{% csrf_token %}
<div class="mb-3">
<label for="Nombre Usuario"> Username:</label>
<input type="text" name="username" id="username" class="form-control"
placeholder="Escriba su Nombre de Usuario">
</div>
<div class="mb-3">
<label for="password1"> Password:</label>
<input type="password" name="password1" id="password1" class="form-control" placeholder="Escriba su Password">
</div>
<div class="mb-3">
<label for="password2"> Confirm your password:</label>
<input type="password" name="password2" id="password2" class="form-control" placeholder="Escriba su Password">
</div>
<button class="btn btn-primary">Signup</button>
</form>
</div>
</div>
</main>
{% endblock %}
61 changes: 34 additions & 27 deletions tasks/templates/task_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,38 @@

{% block content %}

{{task.title}}

{{error}}

<form method="POST">
{% csrf_token %}
{{form.as_p}}

<button>
Update
</button>
</form>

<form action="{% url 'complete_task' task.id %}" method="POST">
{% csrf_token %}
<button>
complete
</button>
</form>

<form action="{% url 'delete_task' task.id %}" method="POST">
{% csrf_token %}
<button>
delete
</button>
</form>

<main class="container">
<div class="row">
<div class="col-md-4 offset-md-4">
<h1 class="text-secondary"> {{task.title}} </h1>
{{error}}
<form method="POST">
{% csrf_token %}
{{form.as_p}}
<button class="btn btn-primary">
Update
</button>
</form>

<div class="mt-5 d-flex">

<form action="{% url 'complete_task' task.id %}" method="POST">
{% csrf_token %}
<button class="btn btn-secondary">
complete
</button>
</form>

<form action="{% url 'delete_task' task.id %}" method="POST">
{% csrf_token %}
<button class="btn btn-danger">
delete
</button>
</form>

</div>
</div>

</div>
</main>
{% endblock %}
40 changes: 24 additions & 16 deletions tasks/templates/tasks.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
{% extends 'base.html' %} {% block content %}

<h1>tasks</h1>
<main class="container">
<div class="row">
<div class="col-md-6 offset-md-3">
<h1 class="text-center display-3 py-5">Tasks Pending</h1>
<ul class="list-group">
{% for task in tasks %}
<a class="list-group-item" href="{% url 'task_detail' task.id %}">
<header class="d-flex justify-content-between">
{% if task.important %}
<h1 class="fw-bold text-success">{{task.title}}</h1>
{% else %}
<h1 class="fw-bold">{{task.title}}</h1>
{% endif %}
<p>{{task.user.username}}</p>
</header>
<p>{{task.description}}</p>

<ul>
{% for task in tasks %}
<li>
<a href="{% url 'task_detail' task.id %}">
{% if task.important %}
<strong>{{task.title}}</strong>
{% else %} {{task.id}} {{task.title}} {% endif %}
<p>{{task.description}}</p>
{{task.datecompleted|date:'M j Y:i'}}
</a>
{% endfor %}
</ul>

{{task.datecompleted|date:'M j Y:i'}}
</a>
</li>
{% endfor %}
</ul>

{% endblock %}
</div>
</div>
</main>
{% endblock %}