Giter Club home page Giter Club logo

waynelambert / portfolio Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 31.78 MB

Portfolio site demonstrating skills with Python, Django, JavaScript, HTML, Sass, PostgreSQL, pytest, Docker, and Git.

Home Page: https://waynelambert.dev

Python 6.20% Dockerfile 0.11% HTML 10.94% JavaScript 53.17% CSS 23.99% SCSS 5.58% Shell 0.01%
bootstrap4 coverage django django-rest-framework docker github githubactions heroku html javascript poetry postgresql pytest python sass simple-email-service

portfolio's Introduction

Welcome to my GitHub Profile!

 ๐Ÿ Python Web Engineer | Django Developer
 ๐Ÿ“ Birmingham, UK
 ๐Ÿ“ Builds intuitive, interactive, and scalable web apps

Python and Django

 Other than web development and programming, other passions
 include technology, sports, and travelling.

  Latest Blog Posts

  โžก๏ธ How to Implement List View Pagination with Django
  โžก๏ธ Calculating the Fibonacci Sequence in Python
  โžก๏ธ Finding the Largest or Smallest n Items in Python
  โžก๏ธ Quick Tip: VS Code Snippet for Python Developers
  โžก๏ธ Integrate a Bootstrap File Upload Utility in Django

portfolio's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar waynelambert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bhargav1010

portfolio's Issues

Missing Author Name for Posts - by User view

The following view does not have enough context to provide the template with the author view.

class UserPostListView(PostView):
    """ Drives the list of posts written by a given author """
    template_name = 'blog/user_posts.html'
    paginate_by = 6
    paginate_orphans = 3

    def get_queryset(self):
        user = get_object_or_404(get_user_model(), username=self.kwargs.get('username'))
        return self.queryset.filter(author=user)

Browsing the posts view by author at the following URL results in the user not being diplayed.

http://localhost:8001/blog/user/bill-gates/posts

The current code displays the username that is logged in rather than the username associated with the posts. ๐Ÿคฆ๐Ÿผโ€โ™‚๏ธ

Pagination on Detail Page

Make the large buttons navigate between a next and previous post. For this, the detail page needs some context of neighbouring posts according to a sort order. A nice touch here would be to put the post title onto the buttons.

This could be taken out if it is considered surplus to requirements as it is a "nice to have"

Migrate Project Config into pyproject.toml

Move any config that can be moved from .ini, .cfg, .bandit, or .coveragerc files into pyproject.toml`.

This may be increasingly possible over time as projects like PyTest and Coverage increase and improve their support for this.

Wagtail Integration

This issue is more of an aspirational item. I would like to integrate Wagtail into the project to give me more flexibility with posting non-standard data to the blog. At the moment, the functionality is slightly constrained by the limitations of the CK Editor.

Sass Compilation

There is a problem with the Sass compilation within the project which is preventing some CSS changes affecting the project.

Some fixes have been verified with the adjustments being represented correctly in Firefox Dev Tools.

Countdown Numbers

The countdown_numbers app has a bug whereby if a user inputs an invalid calculation which meets the current validation conditions but does not parse by the eval function, an error is generated.

An example calculation to generate this bug is:

(100*5)-((10/5/)/2)

This is because of the /) part of the string which forms an invalid calculation string.

I can either approach this by using some cleaning regex to remove the additional / step, or redirect the user back to the page with an additional message within the messages framework. The former would involve trying to pre-empt the user's calculation so this doesn't appear to be the correct approach.

Current Conditions of Calculation

  • Use a matching number of rounded
  • brackets
  • Use only digits
  • Use only the +, -, *, and / arithmetic operators
  • Do not use an equals (=) sign
  • Do not specify the calculation's answer

Categories in API

Change the categories within the endpoints from displaying the IDs to the names.

Footer Section

The footer section is very basic at the moment. I would like to implement something like the Tempo theme, however the site is sparse on static pages at the moment, so will only use a fraction of the links that a deep footer affords.

Reorganise Project

The project has grown significantly since the early days.

It needs to be reorganised so that it's more maintainable going forward and in line with 12 factor app principles.

The following work is required to complete this:

  • Collate all Django apps into their own directory

  • Rename the ab_back_end directory to aa_project. It no longer needs to be identified as back end since the React front-end was removed from the project some time ago.

  • Splitting the settings.py file into base.py, dev.py, and prod.py files. These should all belong in their own directory within the project folder.

  • Rename ADMIN_ALIAS environment variable to DJANGO_ADMIN_LOGIN_PATH

  • Reconfigure some of the settings to be more manageable.

Pagination Issue

At the moment, there is an issue with the pagination code whereby if a user searches for a keyword that returns exactly the number of results that the paginate_by variable in the view is configured, the paginator object returns an additional number. This means that there is actually no objects on the additional paginator object which means when the user navigates to that page, it cannot find it and therefore the response is cannot use None as a query.

The test case is searching for the keyword python which returns 10 posts. The paginate_by setting is 10, therefore all results should be displayed on one page and therefore there is no requirement for a paginator object to appear.

Password Reset Feature

The password reset feature needs to be investigated. It does not seem to recognise the address.

Deployment Plan

The following tasks should be undertaken to deploy the project:

  • Investigate setting up GitHub actions for CI / CD
  • Check Heroku app for Postgres
  • Set up all of the necessary environment variables in Heroku
  • Work through Django's deployment checklist. The settings included in my last project can also be used for guidance
  • Take special consideration for all of the static files
  • Test all of the issues that require deployment first
  • Complete database migrations upon deployment

Blog Content

A list of items that have been resolved within the development of this project which makes for a good blog post.

  • Integrating a Bootstrap File Upload Utility into Django including confirmation of the file used
  • Implementing pagination for a list view using Django and Bootstrap
  • Implementing pagination for a detail view using Django and Bootstrap
  • How to Implement select_related and prefetch_related to reduce the number of queries ran and to speed up your site
  • Adding Tiny MCE Editor to your Django website
  • How to add a useful debug f string snippet for VS Code
  • Update Project to Use Latest Version of Python

Blog Post Images

The images for the blog post app and more generally on the main blog and portfolio pages need some consideration.

The ideal would be that a user uploads the main blog post image through the create/update forms.

  • The main image could be used within the detail page.

  • Another image size is required for the site home page.

  • Another image size is required for the blog home page.

  • It may also be a nice touch to get a thumbnail sized image and add this to the search results and contents pages.

Text Analysis

When entering the analyse page, the text area is initiated with a tabbed indent already there. This means that the text area's placeholder text Enter text here is not visible upon page load.

FAQ Section

I would like to implement an FAQ section within the main home page. The Tempo theme has a good example of how this would work.

Skills Page

A page that details the context, qualification and quantification of my skills.

Unit Tests

Unit tests need to be written for the project's apps.

Adding New User or Post from Admin Panel Results in Server Error

When attempting to add a new user or post object from the admin panel, a server error is thrown. This is because it tries to render a user or post image using the admin model's method, however since there is no object to render, the exception is thrown.

add-post-in-admin-issue

add-post-in-admin-issue2

Responsive Design Issues for Skills Pages

The skills pages are displaying the images too widely on mobile devices. The images are too wide for the iPad display meaning that the supplementary text looks narrow.

Game Rendering

Both the countdown_letters and countdown_numbers apps could be improved with a little bit of front-end work. They currently work fine, however I would like the render out the letters and numbers for the games using BootStrap cards embedded within table elements which would make them look like the actual letters and numbers on the game show.

Update Profile Form Issues

The form has a multiple form setup involving one for the Django User model and the other a Profile model connected using signals.

There are 3 problems with the form that need to be resolved.

  1. The form does not post successfully

  2. The form doesn't prepopulate for the fields which are from the profile form such as the author view radio buttons.

  3. The form also doesn't pre-populate the image being used in the custom bootstrap file image box.

Contact Form

The contact form has been developed and posts successfully to the database, however it does not pass the is_valid check because the Captcha is required. This will need a new implementation of the captcha and involve looking at the Google documentation for the capture.

The form also fails the unit test for the same reason.

Blog Photos

Due to the difference in orientation of the images, the aspect ratio cannot be maintained, therefore the quality of the image on the list pages is inadequate.

Each blog post needs two images:

  1. The main image on the detail page. This has a landscape orientation.

  2. An image for the pages:home and blog:home pages. This has a portrait orientation. I could call the field tile_image.

This means I need a new image field in the Post model of the database and to render this image to those pages instead.

Custom Error Pages

Create a series of custom error pages for the project.

  • 400 - handler400 = BadRequestView.as_view()

  • 403 - handler403 = SitePermissionDeniedView.as_view()

  • 404 - handler404 = SitePageNotFoundView.as_view()

  • 500 - handler500 = SiteErrorView.as_view()

CK Editor: WYSIWYG Editor Issue

The WYSIWYG editor for CK Editor has most of the icons greyed out and therefore unavailable. These are available within the the development environment and this issue only presents itself in production.

In development:

ck_editor_issue_working

In production:

ck_editor_issue_not_working

I suspect it is to do with one of the icons that I added since the last known working configuration.

Alternatively, the PostgreSQL database versions are close, however, not identical. In dev, the version is the Alpine version 11.8 from Docker Hub. In production, the version is 11.8 but the full PostgreSQL version as supplied by the Heroku add-on.

Log File Contents

The logging isn't functional in development at the moment, however it is on the production site. Need to investigate.

Additionally, I need to make a style in Sass for the log file contents for the 'destination_log_file` page.

Django Upgrade to 3.1.x

An attempt to upgrade to Django 3.1 was undertaken on a local django-upgrade branch. It installed with no issues, however there is an issue with the Django admin.

django-admin-issue

  • Browser cache has had a hard refresh and full delete history
  • Also tried with Opera from fresh browser instance and no history
  • Ran collect static

Hopefully this will be resolved with version 3.1.1 at the start of September.

For now, I will keep the master branch on version 3.0.9

Profile Page

The profile page needs more work to make this look more presentable.

It would also be useful to add some resizing and compressing of profile avatar images using Pillow.

Scraping App: Referendum Results Table

The results of the table is fine, however the rendering of the table is not in the desired style. I would like to use the "table-striped" Bootstrap format which means working out how the template needs to be rendered with Django templating.

About Me Page

Adjust the About Me page to be more engaging and add some images.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.