From 9a1f4bc35bf43da707bc9ffd0d4379888160c791 Mon Sep 17 00:00:00 2001 From: Seyi Pythonian Date: Thu, 22 Feb 2024 03:22:35 +0100 Subject: [PATCH] added project requirements update script command --- apps/core/management/commands/create_admin.py | 6 +- apps/core/management/commands/pip_updates.py | 37 ++++++ apps/core/views.py | 89 ++++++--------- templates/base.html | 52 ++++++--- templates/core/companies.html | 47 ++++---- templates/core/faq.html | 4 +- templates/core/home.html | 107 +++++++++++------- templates/core/resumes.html | 39 ++++--- templates/employees/dashboard.html | 59 ++++++---- templates/employees/messages.html | 24 ++-- templates/employers/candidates.html | 12 +- templates/jobs/list.html | 78 ++++++++----- templates/partials/_footer.html | 55 ++++++--- 13 files changed, 380 insertions(+), 229 deletions(-) create mode 100644 apps/core/management/commands/pip_updates.py diff --git a/apps/core/management/commands/create_admin.py b/apps/core/management/commands/create_admin.py index 95472e7..1e357f7 100644 --- a/apps/core/management/commands/create_admin.py +++ b/apps/core/management/commands/create_admin.py @@ -3,9 +3,9 @@ class Command(BaseCommand): - help = 'Create a new superuser' + help = "Create a new superuser" def handle(self, *args, **options): - User.objects.create_superuser(username='admin', email='admin', password='admin') + User.objects.create_superuser(username="admin", email="admin@admin.com", password="admin") - self.stdout.write(self.style.SUCCESS('Superuser created successfully!')) + self.stdout.write(self.style.SUCCESS("Superuser created successfully!")) diff --git a/apps/core/management/commands/pip_updates.py b/apps/core/management/commands/pip_updates.py new file mode 100644 index 0000000..a8c58c7 --- /dev/null +++ b/apps/core/management/commands/pip_updates.py @@ -0,0 +1,37 @@ +import subprocess + +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = "Check for and update outdated Python packages using pip." + + def handle(self, *args, **options): + try: + # Use pip list to get a list of outdated packages + outdated_packages = subprocess.check_output( + ["pip", "list", "--outdated", "--format=columns"], universal_newlines=True + ) + + if not outdated_packages.strip(): + self.stdout.write(self.style.SUCCESS("All packages are up to date!")) + return + + self.stdout.write("Outdated packages:") + self.stdout.write(outdated_packages) + + # Ask the user if they want to update packages + response = input("Do you want to update these packages? (y/n): ").strip().lower() + + if response == "y": + # Upgrade outdated packages + subprocess.call( + ["pip", "install", "--upgrade"] + + [line.split()[0] for line in outdated_packages.strip().split("\n")[2:]] + ) + self.stdout.write(self.style.SUCCESS("Packages updated successfully!")) + else: + self.stdout.write(self.style.NOTICE("No packages were updated.")) + + except Exception as e: + self.stderr.write(self.style.ERROR(f"An error occurred: {str(e)}")) diff --git a/apps/core/views.py b/apps/core/views.py index 007e876..aeccdda 100644 --- a/apps/core/views.py +++ b/apps/core/views.py @@ -5,7 +5,6 @@ from apps.core.utils import mk_paginator from apps.jobs.models import Job, State, Category - from .models import Testimonial @@ -23,17 +22,17 @@ def home(request): categories = Category.objects.all()[:8] testimonials = Testimonial.objects.all()[:3] - template = 'core/home.html' + template = "core/home.html" context = { - 'jobs': jobs, - 'jobs_count': Job.active.all().count(), - 'companies': companies, - 'companies_count': Company.objects.all().count(), - 'states_count': State.objects.all().count(), - 'resumes': resumes, - 'resumes_count': Resume.objects.all().count(), - 'categories': categories, - 'testimonials': testimonials, + "jobs": jobs, + "jobs_count": Job.active.all().count(), + "companies": companies, + "companies_count": Company.objects.all().count(), + "states_count": State.objects.all().count(), + "resumes": resumes, + "resumes_count": Resume.objects.all().count(), + "categories": categories, + "testimonials": testimonials, } return render(request, template, context) @@ -42,11 +41,11 @@ def home(request): @login_required def dashboard(request): if request.user.is_company: - return redirect('employers:account') + return redirect("employers:account") elif request.user.is_employee: - return redirect('employees:dashboard') + return redirect("employees:dashboard") else: - return redirect('core:home') + return redirect("core:home") def companies(request): @@ -65,9 +64,9 @@ def companies(request): companies = Company.objects.filter(jobs__isnull=False).distinct() companies = mk_paginator(request, companies, 12) - template = 'core/companies.html' + template = "core/companies.html" context = { - 'companies': companies, + "companies": companies, } return render(request, template, context) @@ -85,10 +84,10 @@ def company_detail(request, slug): company = get_object_or_404(Company, slug=slug) jobs = company.jobs.all() - template = 'employers/detail.html' + template = "employers/detail.html" context = { - 'company': company, - 'jobs': jobs, + "company": company, + "jobs": jobs, # 'last_seen': request.user.last_seen, } @@ -99,9 +98,9 @@ def resumes(request): resumes = Resume.objects.all() resumes = mk_paginator(request, resumes, 12) - template = 'core/resumes.html' + template = "core/resumes.html" context = { - 'resumes': resumes, + "resumes": resumes, } return render(request, template, context) @@ -109,80 +108,64 @@ def resumes(request): def help_center(request): - template = 'core/help-center.html' - context = { - - } + template = "core/help-center.html" + context = {} return render(request, template, context) def help_article(request): - template = 'core/help-article.html' - context = { - - } + template = "core/help-article.html" + context = {} return render(request, template, context) def help_category(request): - template = 'core/help-category.html' - context = { - - } + template = "core/help-category.html" + context = {} return render(request, template, context) def faq(request): - template = 'core/faq.html' - context = { - - } + template = "core/faq.html" + context = {} return render(request, template, context) def about(request): - template = 'core/about.html' - context = { - - } + template = "core/about.html" + context = {} return render(request, template, context) def policy(request): - template = 'core/policy.html' - context = { - - } + template = "core/policy.html" + context = {} return render(request, template, context) def post(request): - template = 'core/post.html' - context = { - - } + template = "core/post.html" + context = {} return render(request, template, context) def contact(request): - template = 'core/contact.html' - context = { - - } + template = "core/contact.html" + context = {} return render(request, template, context) diff --git a/templates/base.html b/templates/base.html index f922975..c4fdec9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,7 @@ {% load static %} + @@ -13,17 +14,20 @@ {% if request.user.is_authenticated and not user.email_verified %} - @@ -134,4 +149,5 @@ {% block scripts %}{% endblock scripts %} - + + \ No newline at end of file diff --git a/templates/core/companies.html b/templates/core/companies.html index 4dd6dd7..a5c67f8 100644 --- a/templates/core/companies.html +++ b/templates/core/companies.html @@ -5,6 +5,7 @@ {% block content %} +{% if companies %}
@@ -12,19 +13,20 @@

{{ companies.paginator.count }} {% trans 'Hiring Companies' %}

- {% if companies %} {% trans 'We have curated below job openings by hiring companies on our platform. Use the advanced search filter to narrow down job searches.' %} - {% endif %}

- company-right + company-right
+{% endif %}
+ {% if companies %}
- {% if companies %}
-

Showing {{ companies.start_index }}-{{ companies.end_index }} of {{ companies.paginator.count }} companies

+

Showing {{ companies.start_index }}-{{ companies.end_index }} of {{ companies.paginator.count }} companies

{% for company in companies %} -
{% include 'partials/_company_grid.html' %}
+
+ {% include 'partials/_company_grid.html' %}
{% endfor %}
{% include 'partials/_pagination.html' with page_obj=companies %} - {% else %} -
-
- emptycompanies -
-

No Company Account Registered Yet.

+
+ {% else %} +
+
+ emptycompanies
- {% endif %} +

No Hiring Company Available Yet.

+ {% endif %}
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/core/faq.html b/templates/core/faq.html index a09f588..03d2729 100644 --- a/templates/core/faq.html +++ b/templates/core/faq.html @@ -22,8 +22,10 @@

{% trans 'Frequently Asked Questions' %}

{% include 'partials/_faq_grid.html' %} + {% include 'partials/_faq_grid.html' %} + {% include 'partials/_faq_grid.html' %}
-{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/templates/core/home.html b/templates/core/home.html index 55e7fd9..3f4ba89 100644 --- a/templates/core/home.html +++ b/templates/core/home.html @@ -10,9 +10,15 @@
-

{% trans 'Find the latest available' %}
Blue collar jobs {% trans 'in Nigeria.' %}

-

{% trans 'Find jobs that match your interests with us. Over here, we provide a place for you to find non-professional jobs.' %}

- {% trans 'Get Started' %} +

{% trans 'Find the latest available' %}
Blue collar + jobs {% trans 'in Nigeria.' %}

+

+ {% trans 'Find jobs that match your interests with us. Over here, we provide a place for you to find non-professional jobs.' %} +

+ + {% trans 'Get Started' %} +
@@ -33,9 +39,12 @@

{% trans 'Find the latest available' %}

{% trans 'How It Works' %}

{% trans 'Follow our Steps' %},
{% trans 'we will help you' %}!

    -
  • {% trans 'Trusted and Quality Jobs' %}
  • -
  • {% trans 'No Hidden Fees' %}
  • -
  • {% trans 'Seamless User Experience' %}
  • +
  • + {% trans 'Trusted and Quality Jobs' %}
  • +
  • + {% trans 'No Hidden Fees' %}
  • +
  • + {% trans 'Seamless User Experience' %}
@@ -47,7 +56,9 @@

{% trans 'Follow our Steps' %},
{% trans 'we will

{% trans 'Register' %}
{% trans 'Your Account' %}
-

{% trans 'Setup an account with us to find the jobs that best suit your preference.' %}

+

+ {% trans 'Setup an account with us to find the jobs that best suit your preference.' %} +

@@ -58,7 +69,9 @@
{% trans 'Register' %}
{% trans 'Your Account' %}
{% trans 'Create' %}
{% trans 'Your Resume' %}
-

{% trans 'Create your first resume which you can customise as much as you wish.' %}

+

+ {% trans 'Create your first resume which you can customise as much as you wish.' %} +

@@ -69,7 +82,9 @@
{% trans 'Create' %}
{% trans 'Your Resume' %}
{% trans 'Search' %}
{% trans 'Available Jobs' %}
-

{% trans 'Use our advanced search filter to narrow down on jobs specific to you.' %}

+

+ {% trans 'Use our advanced search filter to narrow down on jobs specific to you.' %} +

@@ -80,7 +95,8 @@
{% trans 'Search' %}
{% trans 'Available Jobs' %}
{% trans 'Submit' %}
{% trans 'An Application' %}
-

{% trans 'Send your resume to the hiring company with a click of the button.' %}

+

+ {% trans 'Send your resume to the hiring company with a click of the button.' %}

@@ -100,12 +116,12 @@

{% trans 'Find Your Career Because You Deserve It' %}

{% for job in jobs %}
{% include 'partials/_job_grid.html' %}
{% empty %} -
-
- emptyjobs -
-

No Job Opening Created Yet.

+
+
+ emptyjobs
+

No Job Opening Created Yet.

+
{% endfor %}
{% if jobs_count > 4 %} @@ -151,24 +167,24 @@
{% trans 'Resumes' %}

{% trans 'Featured Resumes' %}

{% for resume in resumes %} -
{% include 'partials/_resume_grid.html' %}
- {% if forloop.last %} -
-
-
-

Browse The Best Resumes Available Here

- View All -
-
+
{% include 'partials/_resume_grid.html' %}
+ {% if forloop.last %} +
+
+
+

Browse The Best Resumes Available Here

+ View All
- {% endif %} +
+
+ {% endif %} {% empty %} -
-
- emptyresume -
-

No Resumes Data Created Yet.

+
+
+ emptyresume
+

No Resumes Data Created Yet.

+
{% endfor %}
@@ -184,12 +200,12 @@

{% trans 'Browse Companies with Available Jobs' %}

{% for company in companies %}
{% include 'partials/_company_grid.html' %}
{% empty %} -
-
- emptycompanies -
-

No Company Account Registered Yet.

+
+
+ emptycompanies
+

No Hiring Company Available Yet.

+
{% endfor %}
{% if companies_count > 6 %} @@ -211,32 +227,43 @@

{% trans 'What Our Customers Say About Us' %}

{% include 'partials/_testimonial_grid.html' %}
+ {% empty %} +
+
+ emptycompanies +
+

No Testimonials Yet.

+
{% endfor %} +{% if not request.user.is_authenticated %}
-
+
interview
-

Need a Personalized Solution?

+

{% trans 'Are you ready to Onboard?' %}

Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat eos explicabo iste ipsam vero! Aspernatur.

- + + {% trans 'Register Today' %} +
-
+{% endif %}
@@ -255,4 +282,4 @@

{% trans 'Latest Updates from Us' %}

-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/core/resumes.html b/templates/core/resumes.html index 190436f..e59518c 100644 --- a/templates/core/resumes.html +++ b/templates/core/resumes.html @@ -5,6 +5,7 @@ {% block content %} +{% if resumes %}
@@ -12,17 +13,16 @@

{{ resumes.paginator.count }} {% trans 'Resumes Available Now' %}

- {% if resumes %} {% trans 'We have curated below professional resumes from some of the top talents on our platform. Use the advanced search filter to narrow down resume searches.' %} - {% endif %}

resume-right
+{% endif %} -
+
{% if resumes %} @@ -31,14 +31,17 @@

{{ resumes.paginator.count }} {% trans 'Resumes
- - + +

- + @@ -116,7 +120,8 @@

{{ resumes.paginator.count }} {% trans 'Resumes
-

-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/employees/dashboard.html b/templates/employees/dashboard.html index e835c05..c3c772a 100644 --- a/templates/employees/dashboard.html +++ b/templates/employees/dashboard.html @@ -11,39 +11,42 @@
-
+
- +
-

5

+

5

APPLICATIONS

-
+
- +
-

9+

+

9+

MESSAGES

-
+
- +
-

0

+

0

JOB ALERTS

@@ -51,23 +54,27 @@

0

-
Recent Activities
+
Recent Activities +
  • - Elon Mosque has sent you private message. + Elon Mosque has sent you private + message.
    few seconds ago.
  • - Your job application for Product Designer has been approved. + Your job application for Product + Designer has been approved.
    3 minutes ago.
  • - You bookmarked the job Remote opportunity for intern product designers. + You bookmarked the job Remote + opportunity for intern product designers.
    1 hour ago.
  • @@ -79,21 +86,25 @@
    <
  • - You have new job alert for UI/UX Developer & Designer. + You have new job alert for UI/UX + Developer & Designer.
    a week ago.
  • - Your job application for Home dry-cleaning service was declined. + Your job application for + Home dry-cleaning service was declined.
    2 months ago.
-
Unread Messages
+
Unread Messages +
- +
@@ -107,7 +118,8 @@
+
@@ -121,7 +133,8 @@
+
@@ -135,7 +148,8 @@
+
@@ -149,7 +163,8 @@
+
- Application received - Hey Seyi, we just want to let you know that ... + Application received - Hey Seyi, we just want to let you know that + ...
6:38am @@ -87,7 +89,8 @@

2

Fikayo Tomori
- I have something important to tell you - Please here me out okay ... + I have something important to tell you - Please here me out okay + ...
8:00am @@ -101,7 +104,8 @@

2

Eze Ebuka
- I have something important to tell you - Please here me out okay ... + I have something important to tell you - Please here me out okay + ...
2:31pm diff --git a/templates/employers/candidates.html b/templates/employers/candidates.html index bd140b2..ac06299 100644 --- a/templates/employers/candidates.html +++ b/templates/employers/candidates.html @@ -11,7 +11,8 @@ {% include 'partials/_company_account_menu.html' %}
- Find Candidates + Find Candidates
Manage Candidates

Manage Resumes of Job Applicants

@@ -21,11 +22,14 @@

Manage Resumes of Job Applicants

- +
{{ candidate.applicant.user.get_full_name }}
- Applied for {{ candidate.job.title }} on: {{ candidate.created|date:"F j Y" }} + Applied for + {{ candidate.job.title }} on: + {{ candidate.created|date:"F j Y" }}
@@ -42,4 +46,4 @@
{{ candidate.applicant.user.get_full_name }}
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/jobs/list.html b/templates/jobs/list.html index faf9c19..1dce862 100644 --- a/templates/jobs/list.html +++ b/templates/jobs/list.html @@ -5,6 +5,7 @@ {% block content %} +{% if jobs %}
@@ -12,19 +13,19 @@

{{ jobs.paginator.count }} {% trans 'Jobs Available' %}

- {% if jobs %} {% trans 'We have curated below job openings by hiring companies on our platform. Use the advanced search filter to narrow down job searches.' %} - {% endif %}

job-right
+{% endif %}
+ {% if jobs %}
@@ -99,7 +111,8 @@

{{ jobs.paginator.count }} {% trans 'Jobs Availa class="fa-solid fa-clock-rotate-left me-1"> Job Posted
- +
{{ jobs.paginator.count }} {% trans 'Jobs Availa
- +
- {{ jobs_last_7_days }} + {{ jobs_last_7_days }}
- +
- {{ jobs_last_30_days }} + {{ jobs_last_30_days }}

@@ -130,11 +147,15 @@

{{ jobs.paginator.count }} {% trans 'Jobs Availa
{% with salary_mode_display=salary_mode|get_salary_mode_display %} - + {% endwith %} - +
- {{ count }} + {{ count }}
{% endfor %} @@ -145,12 +166,12 @@

{{ jobs.paginator.count }} {% trans 'Jobs Availa - +
- {% if jobs %}

Showing {{ jobs.start_index }}-{{ jobs.end_index }} of {{ jobs.paginator.count }} {% trans 'Jobs Availa {% endfor %}

{% include 'partials/_pagination.html' with page_obj=jobs %} - {% else %} -
-
- emptyjobs -
-

No Job Opening Found.

+
+ {% else %} +
+
+ emptyjobs
- {% endif %} +

No Job Opening Found.

- + {% endif %}

-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/templates/partials/_footer.html b/templates/partials/_footer.html index 8094d68..d62f628 100644 --- a/templates/partials/_footer.html +++ b/templates/partials/_footer.html @@ -11,25 +11,43 @@

Blue Jobs

-
Contact Support
+
Quick Links
@@ -46,11 +64,16 @@
Newsletter

- - - + + +
- Back to top + Back + to top
- + \ No newline at end of file