django-planet

Blog: Matt Layman

web https://www.mattlayman.com/tags/django/
Author

A Week At A Time - Building SaaS #46

Feb. 26, 2020 » Django on Matt Layman » [Archived Version]

In this episode, we worked on a weekly view for the Django app. We made navigation that would let users click from one week to the next, then fixed up the view to pull time from that particular week. The first thing that I did was focus on the UI required to navigate to a new weekly view in the app. We mocked out the UI and talked briefly about the flexbox layout that is available to modern browsers.

Read More

Templates and Logic - Building SaaS #45

Feb. 20, 2020 » Django on Matt Layman » [Archived Version]

In this episode, we added content to a template and talked about the N+1 query bug. I also worked tricky logic involving date handling. The first change was to update a course page to include a new icon for any course task that should be graded. After adding this, we hit an N+1 query bug, which is a performance bug that happens when code queries a database in a loop. We talked about why this happens and how to fix it.

Read More

Fast Forms With UpdateView - Building SaaS #44

Feb. 6, 2020 » Django on Matt Layman » [Archived Version]

In this episode, we worked on an edit view. We used Django’s generic UpdateView to aid the process and test drove the creation of the view to verify things every step of the way. We worked on a view to make it possible to edit the CourseTask model that are the actions that a student must complete for a course. To complete the form quickly, I took advantage of Django’s ModelForm views.

Read More

Django Riffs, a podcast for learning Django

Feb. 6, 2020 » Django on Matt Layman » [Archived Version]

I’ve started a podcast! The podcast is called Django Riffs, and my goal is to help beginners learn how to use Django. You can find the show at djangoriffs.com or check iTunes, Spotify, or wherever you get podcasts. Each episode of the podcast will be a topical exploration of one facet of the Django web framework. With many years of Django under my belt, I believe I have the experience to help beginners on their journey into learning Django.

Read More

Episode 2 - Enter With URLs

Jan. 31, 2020 » Django on Matt Layman » [Archived Version]

On this episode, we discuss Django’s front door, URLs. We talk about what URLs are, how to build them in Django, and the functions Django provides to work with URLs. Listen at djangoriffs.com. What’s a URL? A URL is a Uniform Resource Locator. It is the full address that goes into a browser. Consider https://www.mattlayman.com/django-riffs/. Here are the parts: Scheme, https:// Domain name: Top Level Domain (TLD), com Domain, mattlayman Subdomain, www Path or route, /django-riffs/…

Read More

Episode 1 - Get To Know Django

Jan. 30, 2020 » Django on Matt Layman » [Archived Version]

Welcome to the show notes for the first episode of Django Riffs! Django Riffs is a podcast for learning web application development in Python using the Django web framework. Listen at djangoriffs.com. Who Is This For? This podcast is for absolute Django beginners. No prior knowledge of Django or web development is expected. Experienced users may learn something new or get a good refresher from topics they might have missed in the documentation.

Read More

Use Tailwind On A Template - Building SaaS #43

Jan. 23, 2020 » Django on Matt Layman » [Archived Version]

In this episode, we worked on the template styles of a tabular view. We also made some context data adjustments to include header rows and column highlighting. I started by showing the template that I already created. It was rough. Before changing anything, I took the time to explain the modeling in use for this project and the context passed to the view. The models mostly form a tree in the a hierarchy.

Read More

Add Styles To Templates - Building SaaS #42

Jan. 22, 2020 » Django on Matt Layman » [Archived Version]

In this episode, I added a CSS framework, Tailwind CSS. After working through some issues with the log out feature, we started to style the base template of the site. To stay true to my “make the minimum possible thing that will work,” I added Tailwind CSS from a CDN, content delivery network. <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"> I described how Tailwind’s utility-first approach makes designing sites a breeze because of …

Read More

URLs Lead The Way

Jan. 22, 2020 » Django on Matt Layman » [Archived Version]

In the last article in the Understand Django series, we saw how a user’s browser request goes from their browser to Django’s “front door.” Now it’s time to look at how Django processes those requests. An HTTP request coming from a browser includes a URL describing which resource Django should produce. Since URLs can come in many forms, we must instruct Django on the kinds of URLs that our web application can handle.

Read More

User Accounts With django-allauth - Building SaaS #41

Jan. 15, 2020 » Django on Matt Layman » [Archived Version]

In this episode, we added django-allauth to create accounts that default to email instead of using usernames. We added the package, configured some templates, and created tests. We continued to look at Will Vincent’s django-allauth post on creating user accounts with email and passwords. django-allauth let’s us swap out username and email so that users won’t need to create a username, which is the behavior that I want for this service.

Read More