About the Portfolio Project: Django Delights category

Welcome to the subcategory for the Django Delights Project. This portfolio project can be found in the following courses or paths:

Code Review: Why It’s Important

  • Better code quality – improve internal code quality and maintainability (readability, uniformity, understandability)
  • Finding defects – improve quality regarding external aspects, especially correctness, but also find performance problems, security vulnerabilities, injected malware, etc.
  • Learning/Knowledge transfer – help in transferring knowledge about the codebase, solution approaches, expectations regarding quality, etc; both to the reviewers as well as to the author
  • Increase sense of mutual responsibility – increase a sense of collective code ownership and solidarity
  • Finding better solutions – generate ideas for new and better solutions and ideas that transcend the specific code at hand.
  • Complying to QA guidelines – Code reviews are mandatory in some contexts, e.g., air traffic software

For more on why code reviews are important as well as how to give a code review and ask for one, check out this article.

How to Get Feedback on your Project

Congratulations on finishing your portfolio project! Now you’ll want to follow these steps to get feedback on it.

  1. Post a link to your git repository :slight_smile:
  2. Give us a few sentences about your experience. Was this fun? Difficult? How long did it take?
  3. Check back in—if someone has replied to your post, come see what they have to say.

How to Give Feedback on Another Learner’s Project

Reviewing someone else’s code isn’t just a nice thing to do; it’s also a great opportunity to sharpen your skills by viewing a different perspective.

  1. Refer to the article in your Career Path on How to Review Someone Else’s Code
  2. Click through topics in this subcategory to view other submissions of this project.
  3. Reply to a thread with feedback, encouragement, or letting them know if they did something in a way you hadn’t thought of before!
1 Like

Hi. Just completed the Django Delights portfolio Project. As requested, here’s a GitHub link and some observations:

https://github.com/elMolo/menuTools

After reading the project requirements, I read every card in the Kanban board, then I followed the first instruction and figured out the information architecture. Then I wireframed a mockup. Once I started writing Python files, it began to take shape rapidly.
Some of the requirements, like depleting the ingredients inventory after each purchase took me a long time to work through, and I still don’t think I chose the correct path. It felt like in order to make that feature happen, I had to use some information that I hadn’t learnt in the course. Specifically, how to call a function that depletes the inventory each time a user makes a menu purchase from within the purchase form, perhaps via a hidden field. I feel this requires creating a custom purchase form that can access the database with the menu item ID from the choice selected in the form. Since I only know how to use generic forms and templates, I couldn’t make that work. What I did is, I redirected purchase form page on form submission to a purchase confirmation page to which I passed the menu item ID.That page called a view function that updated the database with the depleted quantity of each ingredient used in the purchased menu item. It does the trick, but it lacks elegance.
There were other snags that I mostly solved reading through Django documentation.
Although the project goals didn’t focus much on presentation, I snagged a CSS file from a Django course lesson for a fast and dirty implementation. It looks better than nothing, but it needs tweaking and it contains a lot of unused declarations. As a relaxing break from Django coding, I intend to tweak the CSS to make the frontend look presentable.

2 Likes

Hello there! Just finished the same project as you.

Good job! I like you put some effort in styling, the elephant logo is also cool :slight_smile: Is it from codecademy course? Or you made it yourself?

Even though I am newbie, I have forked your project and found some points to work on. Hope you’ll find them helpful.

  1. Going to ‘purchases’ page raised me an error ‘Page not found’. You should add ‘/’ after the path URL in ‘urlpatterns’ list from ‘urls.py’. Change “path(‘purchases’, views.Purchases.as_view(), name=‘purchases’)” to “path(‘purchases/’, views.Purchases.as_view(), name=‘purchases’)”. The same for other paths.

  2. When adding ‘recipe requirement’ with the same ‘ingredient’ twice (or more times) to the menu item I got duplicates of ingredients. I didn’t solved this issue in my project completely, but I used a dictionary to gather the info about all the ingredients (with theirs amounts) for every menu item.
    Like ‘dictionary_with_ingredients = {
    ingredient.id : { ‘name’: ‘Sugar’, ‘amount_needed’ = 10, … },
    ingredient.id : { ‘name’: ‘Oil’, ‘amount_needed’ = 5, … },

    }.ingredient[‘amount’]’.
    Due to the same ‘ingredient.id’ value, we have only unique ingredients (from the last entries) on the front-end. Though, still have duplicates in database. :slight_smile:

  3. From what I found on youtube, It is recommended to separate the business logic from views.py to something like ‘services.py’. This way we get clean and easy to read ‘views.py’ file. You can ‘move total_purchases_cost’ and ‘total_sales_price’ functions to a separate file, then import them in ‘views.py’.

Thank you for sharing your project! Really appreciate your work!

And here is mine: GitHub - artyks/delights

1 Like

Hi Artem, thanks so much for looking over myproject submission.

The logo is my own. I am a graphic designer, so it just came out while I was styling.
I can see why it is so useful to peer review the project. None of the errors you flagged came up when I tested. I am grateful for your review. I will look over your notes and your fork ASAP. I am currently in the middle of a CSS class, so I will focus on getting that done, but I am confident than in a few days I can focus on your contribution, and I’ll be sure to reply. I look forward to looking at the way you did it, BTW. Thanks again.

1 Like

Hihoo fellas! I have just finished my first project with Django at Codecademy.

At this project, since the main focus is to build a working inventory system, I am using Django to handle all of the backend and Bootstrap for giving fresh design to the website. I also utilize the class-based generic views in rendering all of the views. For the form, I am using form-crispy to help me in rendering the form to HTML.

One thing that I might have accomplished and feel proud of it is the menu creation form, where I can dynamically add the dropdown list for the new recipe as well as remove them which I think it’s quite cool.

Here’s the link to my GitHub repo : https://github.com/RandyBrilliant/django-delight

Any feedback and suggestion are welcomed. I hope that my project can also help you in gaining new ideas for the project cause sharing is caring :laughing:.

Hey guys, just finished my portifolio project. I focused on the back end part, so sorry for the site’s appearence. Anyway, here’s the link to the website: https://github.com/lucaskoblitz/djangodelights

Hi all,

First of all, here’s the link! https://github.com/AdrianFebre/Codecademy_django_capstone

I built this site back in August, but I remember it taking a few weeks (two? Not 8 hour days or anything), and being fun to rough out, but really challenging to dial in.

In particular:

P&L

  • I ended up implementing both a class and function P&L generator in views.py, though I remember preferring the class-based method for some reason
  • since we’re dealing with (potentially) a distinct P&L per date, I used pandas to handle that data in the “Classed P&L” section of the site (accessible from the home page)
    • pandas has a nice to_html() method which makes using Pandas in Django easy (the way I implemented it may not look the prettiest, but it’s easy)
  • I used a trick taken from elMolo, evidently, to pass whatever I’d like as context to the page, and I think that was simply a requirement to pass custom context from a class (as opposed to a method, where you get that functionality “for free,” per “Adding extra context” on this doc

Timed stuff, implementing a function on a click

  • I wanted to tie purchases to the time of the button press, since that’s the way real POSes should do it
  • I did a bit of research into the “ideal” way to trigger functions on clicks (i.e. assigning some value to an object, like a timestamp upon a button press), and the result was the timed_strings_create function in views.py
    • I sadly don’t recall the fine details, but HttpResponseRedirect takes the user to the url associated with the timedstringslist name in urls.py (hence “reverse), and newSession.save() obviously saves the session to the database. Render’s role here is a bit lost on me; I think when you first land on the page, the render() line runs, but once you press the button, the session is saved and you’re returned to timedstringslist. I think!
  • I used this method and a TimedStrings class to implement a simple test in the timed-strings page

Misc

  • I had a ton of trouble implementing for loops in one of my templates, and it turns out that it’s safer in some sense to use “ingredients_list” as opposed to “object_list” when referring to an Ingredients object; that, at least, saved my bacon, and here’s what I was able to drum up vis a vis documentation of that just now: (oh whoops, only two links for new users! See templates-builtins in the documentation)
  • I implemented a broad range of __str__ methods, so feel free to browse those
  • I never got around to handling inventory, sorry!
  • I found it helpful to use comment lines to break paths into rough sections in urls.py
  • Apparently, it’s ideal to explicitly name the attributes you’d like to be editable via fields in forms.py (as opposed to “all attributes,” the default)

Thanks for reading, feel free to let me know if anything on this site is far from the ideal implementation/super cumbersome, and hope this helps someone even a tiny bit!

Best,
Adrian