From 0bf7666c524848d6d469aa7cd66b2bb3e48b27c3 Mon Sep 17 00:00:00 2001 From: Victoria Jury Date: Tue, 15 Oct 2024 09:53:45 +0200 Subject: [PATCH 1/4] refactor resume, add models and migrations --- pages/admin.py | 25 ++++- pages/migrations/0001_initial.py | 83 +++++++++++++++++ pages/models.py | 28 +++++- pages/templates/pages/resume.html | 74 +++++++++++++++ pages/views.py | 15 ++- templates/base.html | 6 +- templates/resume.html | 147 ------------------------------ 7 files changed, 223 insertions(+), 155 deletions(-) create mode 100644 pages/migrations/0001_initial.py create mode 100644 pages/templates/pages/resume.html delete mode 100644 templates/resume.html diff --git a/pages/admin.py b/pages/admin.py index 2a54049..cbca48f 100644 --- a/pages/admin.py +++ b/pages/admin.py @@ -1,3 +1,24 @@ -from django.contrib import admin # noqa # pylint: disable=unused-import +from django.contrib import admin +from pages.models import ResumeEducation, ResumeExperience, ResumeSkill, ResumeSummary -# Register your models here. + +class ResumeAdminSummary(admin.ModelAdmin): + list_display = ["name", "address"] + + +class ResumeAdminEducation(admin.ModelAdmin): + list_display = ["location", "date_attended"] + + +class ResumeAdminSkills(admin.ModelAdmin): + list_display = ["skill", "category"] + + +class ResumeAdminExperience(admin.ModelAdmin): + list_display = ["role", "date_attended", "location"] + + +admin.site.register(ResumeSummary, ResumeAdminSummary) +admin.site.register(ResumeEducation, ResumeAdminEducation) +admin.site.register(ResumeSkill, ResumeAdminSkills) +admin.site.register(ResumeExperience, ResumeAdminExperience) diff --git a/pages/migrations/0001_initial.py b/pages/migrations/0001_initial.py new file mode 100644 index 0000000..bbc1dac --- /dev/null +++ b/pages/migrations/0001_initial.py @@ -0,0 +1,83 @@ +# Generated by Django 5.1.2 on 2024-10-15 06:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="ResumeEducation", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("location", models.CharField(max_length=100)), + ("date_attended", models.CharField(max_length=50)), + ("study_details", models.TextField()), + ], + ), + migrations.CreateModel( + name="ResumeExperience", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("role", models.CharField(max_length=100)), + ("date_attended", models.CharField(max_length=50)), + ("location", models.CharField(max_length=100)), + ("role_details", models.TextField()), + ], + ), + migrations.CreateModel( + name="ResumeSkill", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("category", models.CharField(max_length=100)), + ("skill", models.CharField(max_length=50)), + ], + ), + migrations.CreateModel( + name="ResumeSummary", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=100)), + ("bio", models.CharField(max_length=100)), + ("address", models.CharField(max_length=100)), + ("telephone", models.CharField(max_length=50)), + ("email", models.CharField(max_length=100)), + ], + ), + ] diff --git a/pages/models.py b/pages/models.py index 409fd9d..d593553 100644 --- a/pages/models.py +++ b/pages/models.py @@ -1,3 +1,27 @@ -from django.db import models # noqa # pylint: disable=unused-import +from django.db import models -# Create your models here. + +class ResumeSummary(models.Model): + name = models.CharField(max_length=100) + bio = models.CharField(max_length=100) + address = models.CharField(max_length=100) + telephone = models.CharField(max_length=50) + email = models.CharField(max_length=100) + + +class ResumeEducation(models.Model): + location = models.CharField(max_length=100) + date_attended = models.CharField(max_length=50) + study_details = models.TextField() + + +class ResumeSkill(models.Model): + category = models.CharField(max_length=100) + skill = models.CharField(max_length=50) + + +class ResumeExperience(models.Model): + role = models.CharField(max_length=100) + date_attended = models.CharField(max_length=50) + location = models.CharField(max_length=100) + role_details = models.TextField() diff --git a/pages/templates/pages/resume.html b/pages/templates/pages/resume.html new file mode 100644 index 0000000..9265832 --- /dev/null +++ b/pages/templates/pages/resume.html @@ -0,0 +1,74 @@ +{% extends "base.html" %} +{% load static %} +{% block resume_page_content %} + + +
+
+ +
+

Resume

+

Work Experience

+
+ +
+
+

Summary

+
+

{{ summary.name }}

+

{{ summary.bio }}

+ +
+ +

Education

+ + {% for edu in education %} +
+

{{ edu.location }}

+
{{ edu.date_attended}}
+ {{ edu.study_details|safe }} +
+ {% endfor %} + +

Skills

+
+

Technical Skills

+
    + {% for s in technical_skills %} +
  • {{ s.skill }}
  • + {% endfor %} +
+
+
+

Languages

+
    + {% for s in language_skills %} +
  • {{ s.skill }}
  • + {% endfor %} +
+
+
+
+

Professional Experience

+ {% for exp in experience %} +
+

{{ exp.role }}

+
{{ exp.date_attended }}
+

{{ exp.location }}

+ {{ exp.role_details|safe }} +
+ {% endfor %} +
+
+ +
+
+ +{% endblock resume_page_content %} \ No newline at end of file diff --git a/pages/views.py b/pages/views.py index 35737bc..aa50b50 100644 --- a/pages/views.py +++ b/pages/views.py @@ -1,5 +1,18 @@ from django.shortcuts import render +from pages.models import ResumeEducation, ResumeExperience, ResumeSkill, ResumeSummary def home(request): - return render(request, "pages/home.html", {}) + resume_summary = ResumeSummary.objects.first() + resume_education = ResumeEducation.objects.all() + technical_skills = ResumeSkill.objects.filter(category="Technical Skills") + languages = ResumeSkill.objects.filter(category="Languages") + resume_experience = ResumeExperience.objects.all() + context = { + "summary": resume_summary, + "education": resume_education, + "technical_skills": technical_skills, + "language_skills": languages, + "experience": resume_experience, + } + return render(request, "pages/resume.html", context) diff --git a/templates/base.html b/templates/base.html index d44116c..734532e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -50,8 +50,8 @@

I'm a passionate software engineer and web developer