diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 1ec15211..8c3d15d7 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc b/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc index 749ac85b..2cd9dd3d 100644 Binary files a/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc index 99125ae0..eec19d90 100644 Binary files a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index 75633720..d2a65bf3 100644 Binary files a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/0050_projectrequirement_added_by_projectrequirement_date.py b/osinaweb/osinacore/migrations/0050_projectrequirement_added_by_projectrequirement_date.py new file mode 100644 index 00000000..eaac694d --- /dev/null +++ b/osinaweb/osinacore/migrations/0050_projectrequirement_added_by_projectrequirement_date.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.5 on 2024-01-19 18:53 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('osinacore', '0049_alter_customerprofile_business'), + ] + + operations = [ + migrations.AddField( + model_name='projectrequirement', + name='added_by', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='projectrequirement', + name='date', + field=models.DateField(auto_now=True, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/0051_alter_task_requirement.py b/osinaweb/osinacore/migrations/0051_alter_task_requirement.py new file mode 100644 index 00000000..27fa15cd --- /dev/null +++ b/osinaweb/osinacore/migrations/0051_alter_task_requirement.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.5 on 2024-01-19 18:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0050_projectrequirement_added_by_projectrequirement_date'), + ] + + operations = [ + migrations.AlterField( + model_name='task', + name='requirement', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.projectrequirement'), + ), + ] diff --git a/osinaweb/osinacore/migrations/__pycache__/0047_task_status_date.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0047_task_status_date.cpython-310.pyc new file mode 100644 index 00000000..944e324d Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0047_task_status_date.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0048_alter_customerprofile_business.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0048_alter_customerprofile_business.cpython-310.pyc new file mode 100644 index 00000000..1b4533d1 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0048_alter_customerprofile_business.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0049_alter_customerprofile_business.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0049_alter_customerprofile_business.cpython-310.pyc new file mode 100644 index 00000000..6c927732 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0049_alter_customerprofile_business.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0050_projectrequirement_added_by_projectrequirement_date.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0050_projectrequirement_added_by_projectrequirement_date.cpython-310.pyc new file mode 100644 index 00000000..cbf80bb7 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0050_projectrequirement_added_by_projectrequirement_date.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0051_alter_task_requirement.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0051_alter_task_requirement.cpython-310.pyc new file mode 100644 index 00000000..33291cbd Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0051_alter_task_requirement.cpython-310.pyc differ diff --git a/osinaweb/osinacore/models.py b/osinaweb/osinacore/models.py index 8b5e76fa..ec296931 100644 --- a/osinaweb/osinacore/models.py +++ b/osinaweb/osinacore/models.py @@ -172,6 +172,8 @@ class Epic(models.Model): class ProjectRequirement(models.Model): content = models.CharField(max_length=350) project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True) + date = models.DateField(null=True, auto_now=True) + added_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) class ProjectFile(models.Model): @@ -211,6 +213,7 @@ class Task(models.Model): start_date = models.CharField(max_length=200) end_date = models.CharField(max_length=200) assigned_to = models.ForeignKey(StaffProfile, on_delete=models.CASCADE, null=True) + requirement = models.ForeignKey(ProjectRequirement, on_delete=models.SET_NULL, null=True) task_id = models.CharField(max_length=20, null=True, blank=True) def save(self, *args, **kwargs): if not self.task_id: diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index 23a8b08d..ce74eb87 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -514,18 +514,24 @@ def add_businesstype_modal(request, *args, **kwargs): } return render(request, 'popup_modals/addbusinesstype-modal.html', context) + + def add_reference_modal(request, *args, **kwargs): context = { } return render(request, 'popup_modals/addreference-modal.html', context) + + def add_tag_modal(request, *args, **kwargs): context = { } return render(request, 'popup_modals/addtag-modal.html', context) + + def add_business_modal(request, *args, **kwargs): context = { @@ -535,15 +541,33 @@ def add_business_modal(request, *args, **kwargs): return render(request, 'popup_modals/addbusiness-modal.html', context) -def add_user_story_modal(request): + +def add_user_story_modal(request, project_id): + project = get_object_or_404(Project, project_id=project_id) + if request.method == 'POST': + content = request.POST.get('content') + + story = ProjectRequirement( + content = content, + project = project, + added_by = request.user, + ) + story.save() + # Reload the parent page using JavaScript + response = HttpResponse('') + return response + context = { + 'project' : project, + } return render(request, 'popup_modals/add-userstory-modal.html', context) + def staff_position_modal(request): context = { @@ -701,10 +725,10 @@ def save_project(request): project.members.set(members_profiles) # Save project requirements - requirements = request.POST.getlist('requirements') # Assuming 'requirements' is the name of your requirement input field + requirements = request.POST.getlist('requirements') for requirement_content in requirements: if requirement_content: - requirement = ProjectRequirement(content=requirement_content, project=project) + requirement = ProjectRequirement(content=requirement_content, project=project, added_by=request.user) requirement.save() return redirect('my-projects') @@ -717,28 +741,26 @@ def save_epic(request): title = request.POST.get('title') status = request.POST.get('status') description = request.POST.get('description') - project_id = request.POST.get('project') # Get project ID as a string - # Retrieve the Project instance - try: - project = Project.objects.get(id=project_id) - except Project.DoesNotExist: - pass + + project_id = request.POST.get('project') + project = get_object_or_404(Project, id=project_id) + start_date = request.POST.get('start_date') end_date = request.POST.get('end_date') - # Create the Epic object with the Project instance + epic = Epic( title=title, status=status, - project=project, # Assign the Project instance + project=project, description=description, start_date=start_date, end_date=end_date ) - # Save the Epic object to the database + epic.save() # Redirect to the detailed project page @@ -746,43 +768,28 @@ def save_epic(request): return redirect(redirect_url) + @login_required def save_task(request): if request.method == 'POST': name = request.POST.get('name') status = request.POST.get('status') - project_id = request.POST.get('project') - epic_id = request.POST.get('epic') - assigned_to_id = request.POST.get('assigned_to') extra = request.POST.get('extra') description = request.POST.get('description') start_date = request.POST.get('start_date') end_date = request.POST.get('end_date') - try: - project = Project.objects.get(id=project_id) - except Project.DoesNotExist: - # Handle the case where the project with the provided ID doesn't exist - # You might want to display an error message or redirect to an appropriate page. - pass - try: - epic = Epic.objects.get(id=epic_id) - except Epic.DoesNotExist: - # Handle the case where the epic with the provided ID doesn't exist - # You might want to display an error message or redirect to an appropriate page. - pass + project_id = request.POST.get('project') + project = get_object_or_404(Project, id=project_id) + + epic_id = request.POST.get('epic') + epic = get_object_or_404(Epic, id=epic_id) - try: - - assigned_to = StaffProfile.objects.get(id=assigned_to_id) - except StaffProfile.DoesNotExist: - # Handle the case where the StaffProfile with the provided ID doesn't exist - # You might want to display an error message or redirect to an appropriate page. - pass + assigned_to_id = request.POST.get('assigned_to') + assigned_to = get_object_or_404(StaffProfile, id=assigned_to_id) - # Create the Task object with the Project and Epic instances task = Task( name=name, status=status, @@ -799,7 +806,6 @@ def save_task(request): # Save the Task object to the database task.save() - task_id = task.id # Redirect to the task detailed page task_details_url = reverse('detailed-task', args=[task.task_id]) diff --git a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc index 4b79fbe1..7cd21658 100644 Binary files a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinaweb/urls.py b/osinaweb/osinaweb/urls.py index 80961565..b540de66 100644 --- a/osinaweb/osinaweb/urls.py +++ b/osinaweb/osinaweb/urls.py @@ -73,7 +73,7 @@ urlpatterns = [ path('add-note/', views.add_note_modal, name='addnote'), path('add-project-note/', views.add_project_note_modal, name='addprojectnote'), path('add-file/', views.add_file_modal, name='addfile'), - path('add-user-story/', views.add_user_story_modal, name='adduserstory'), + path('add-user-story//', views.add_user_story_modal, name='adduserstory'), path('add-credentials/', views.add_credentials_modal, name='addcredentials'), path('update-status//', views.update_status_modal, name='updatestatus'), path('add-point//', views.add_point_modal, name='addpoint'), diff --git a/osinaweb/static/dist/output.css b/osinaweb/static/dist/output.css index 136ea63c..c2c1cc6c 100644 --- a/osinaweb/static/dist/output.css +++ b/osinaweb/static/dist/output.css @@ -963,10 +963,6 @@ video { width: 12rem; } -.w-\[100px\] { - width: 100px; -} - .w-\[120px\] { width: 120px; } @@ -1862,6 +1858,10 @@ video { padding-right: 1rem; } +.pr-8 { + padding-right: 2rem; +} + .pt-3 { padding-top: 0.75rem; } diff --git a/osinaweb/templates/details_pages/project-details.html b/osinaweb/templates/details_pages/project-details.html index d2ffff19..1bc5df72 100644 --- a/osinaweb/templates/details_pages/project-details.html +++ b/osinaweb/templates/details_pages/project-details.html @@ -243,8 +243,8 @@

Project Details:

-
-

+

+

{{project.details}}

@@ -263,7 +263,7 @@
diff --git a/osinaweb/templates/popup_modals/add-userstory-modal.html b/osinaweb/templates/popup_modals/add-userstory-modal.html index 8d9bae2a..110db9ee 100644 --- a/osinaweb/templates/popup_modals/add-userstory-modal.html +++ b/osinaweb/templates/popup_modals/add-userstory-modal.html @@ -13,7 +13,7 @@ -
+ {% csrf_token %}

Add User Story