-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
816 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class GrowthPlanConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'growth_plan' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django import forms | ||
|
||
from .models import GrowthPlanItem | ||
|
||
|
||
class GrowthPlanItemForm(forms.ModelForm): | ||
class Meta: | ||
model = GrowthPlanItem | ||
fields = [ | ||
'title', | ||
'description', | ||
'start_date', | ||
'end_date', | ||
'progress_percentage', | ||
] | ||
widgets = { | ||
'title': forms.TextInput(attrs={'class': 'form-control'}), | ||
'description': forms.Textarea(attrs={'class': 'form-control'}), | ||
# Specify the date format for start_date and end_date fields | ||
'start_date': forms.DateInput( | ||
format='%Y-%m-%d', | ||
attrs={'class': 'form-control', 'type': 'date'}, | ||
), | ||
'end_date': forms.DateInput( | ||
format='%Y-%m-%d', | ||
attrs={'class': 'form-control', 'type': 'date'}, | ||
), | ||
'progress_percentage': forms.NumberInput( | ||
attrs={'class': 'form-control'} | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 5.0.2 on 2024-02-21 01:59 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='GrowthPlanItem', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=255, verbose_name='Title')), | ||
('description', models.TextField(verbose_name='Description')), | ||
('start_date', models.DateField(verbose_name='Start Date')), | ||
('end_date', models.DateField(verbose_name='End Date')), | ||
('progress_percentage', models.PositiveIntegerField(default=0, help_text='Enter a number between 0 and 100.', verbose_name='Progress Percentage')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='growth_plan_items', to=settings.AUTH_USER_MODEL, verbose_name='User')), | ||
], | ||
options={ | ||
'verbose_name': 'Growth Plan Item', | ||
'verbose_name_plural': 'Growth Plan Items', | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class GrowthPlanItem(models.Model): | ||
user = models.ForeignKey( | ||
settings.AUTH_USER_MODEL, | ||
on_delete=models.CASCADE, | ||
related_name='growth_plan_items', | ||
verbose_name=_('User'), | ||
) | ||
title = models.CharField(max_length=255, verbose_name=_('Title')) | ||
description = models.TextField(verbose_name=_('Description')) | ||
start_date = models.DateField(verbose_name=_('Start Date')) | ||
end_date = models.DateField(verbose_name=_('End Date')) | ||
progress_percentage = models.PositiveIntegerField( | ||
default=0, | ||
verbose_name=_('Progress Percentage'), | ||
help_text=_('Enter a number between 0 and 100.'), | ||
) | ||
|
||
class Meta: | ||
verbose_name = _('Growth Plan Item') | ||
verbose_name_plural = _('Growth Plan Items') | ||
|
||
def __str__(self): | ||
return self.title |
21 changes: 21 additions & 0 deletions
21
src/growth_plan/templates/growth-plan-item-confirm-delete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class="container py-4"> | ||
<h2> | ||
Confirm Delete | ||
</h2> | ||
<p> | ||
Are you sure you want to delete "{{ object.title }}"? | ||
</p> | ||
<form method="post"> | ||
{% csrf_token %} | ||
<button type="submit" | ||
class="btn btn-danger"> | ||
Delete | ||
</button> | ||
<a href="{% url 'user-growth-plan-list' %}" | ||
class="btn btn-secondary">Cancel</a> | ||
</form> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<style> | ||
.invalid-feedback-block { | ||
display: block"; | ||
|
||
} | ||
</style> | ||
<div class="container py-4"> | ||
<h2> | ||
{{ title }} Growth Plan Item | ||
</h2> | ||
<form method="post" | ||
class="needs-validation" | ||
novalidate> | ||
{% csrf_token %} | ||
{% for field in form %} | ||
<div class="mb-3"> | ||
<label for="{{ field.id_for_label }}" | ||
class="form-label"> | ||
{{ field.label }} | ||
</label> | ||
{{ field }} | ||
{% if field.help_text %} | ||
<small class="form-text text-muted">{{ field.help_text }}</small> | ||
{% endif %} | ||
{% for error in field.errors %} | ||
<div class="invalid-feedback invalid-feedback-block"> | ||
{{ error }} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
<button type="submit" | ||
class="btn btn-success"> | ||
Save | ||
</button> | ||
<a href="{% url 'user-growth-plan-list' %}" | ||
class="btn btn-secondary">Back to My Growth Plan</a> | ||
</form> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class="container py-4"> | ||
<h2> | ||
My Growth Plan | ||
</h2> | ||
<div class="row row-cols-1 row-cols-md-3 g-4"> | ||
{% for item in items %} | ||
<div class="col"> | ||
<div class="card h-100"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> | ||
{{ item.title }} | ||
</h5> | ||
<h6 class="card-subtitle mb-2 text-muted"> | ||
{{ item.start_date }} to {{ item.end_date }} | ||
</h6> | ||
<p class="card-text"> | ||
{{ item.description }} | ||
</p> | ||
</div> | ||
<div class="card-footer"> | ||
<p> | ||
<span class="badge text-bg-primary"> | ||
Progress: {{ item.progress_percentage }}% | ||
</span> | ||
</p> | ||
<a href="{% url 'growth-plan-item-edit' item.pk %}" | ||
class="card-link">Edit</a> | ||
<a href="{% url 'growth-plan-item-delete' item.pk %}" | ||
class="card-link">Delete</a> | ||
</div> | ||
</div> | ||
</div> | ||
{% empty %} | ||
<p> | ||
No growth plan items found. | ||
</p> | ||
{% endfor %} | ||
</div> | ||
<a href="{% url 'growth-plan-item-create' %}" | ||
class="btn btn-primary mt-3">Add New Item</a> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class="container py-4"> | ||
<h2> | ||
Growth Plan Review | ||
</h2> | ||
<div class="row"> | ||
{% for item in items %} | ||
<div class="col-md-4 mb-3"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> | ||
{{ item.title }} | ||
</h5> | ||
<h6 class="card-subtitle mb-2 text-muted"> | ||
Assigned to: {{ item.user.get_full_name }} | ||
</h6> | ||
<p class="card-text"> | ||
{{ item.description }} | ||
</p> | ||
<p> | ||
Progress: {{ item.progress_percentage }}% | ||
</p> | ||
<p> | ||
Duration: {{ item.start_date }} to {{ item.end_date }} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
{% empty %} | ||
<p> | ||
No growth plan items to review. | ||
</p> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django.urls import path | ||
|
||
from .views import ( | ||
GrowthPlanItemCreateView, | ||
GrowthPlanItemDeleteView, | ||
GrowthPlanItemUpdateView, | ||
review_growth_plan_list, | ||
user_growth_plan_list, | ||
) | ||
|
||
urlpatterns = [ | ||
path( | ||
'my-growth-plan/', user_growth_plan_list, name='user-growth-plan-list' | ||
), | ||
path( | ||
'review-growth-plans/', | ||
review_growth_plan_list, | ||
name='review-growth-plan-list', | ||
), | ||
path( | ||
'create/', | ||
GrowthPlanItemCreateView.as_view(), | ||
name='growth-plan-item-create', | ||
), | ||
path( | ||
'edit/<int:pk>/', | ||
GrowthPlanItemUpdateView.as_view(), | ||
name='growth-plan-item-edit', | ||
), | ||
path( | ||
'delete/<int:pk>/', | ||
GrowthPlanItemDeleteView.as_view(), | ||
name='growth-plan-item-delete', | ||
), | ||
] |
Oops, something went wrong.