How to Test Django Models (with Examples)
Today we are looking at how to test Django models. If you're completely new to testing, then check out my beginner's guide to testing Django applications.
The application I'm going to test has a model called Movie. My application fetches movies from ...
Read: https://aliceridgway.hashnode.dev/how-to-test-django-models-with-examples
@django_prog
Today we are looking at how to test Django models. If you're completely new to testing, then check out my beginner's guide to testing Django applications.
The application I'm going to test has a model called Movie. My application fetches movies from ...
Read: https://aliceridgway.hashnode.dev/how-to-test-django-models-with-examples
@django_prog
Django Models: How to automatically populate slug fields for URLs
Today, we're looking at how to add a slug field to a Django model that automatically populates itself when you create an object in the database.
Say you’re creating a blog and instead of having each post as https://myblog/post/1, you want https://myb...
Read: https://aliceridgway.hashnode.dev/django-models-how-to-automatically-populate-slug-fields-for-urls
@django_prog
Today, we're looking at how to add a slug field to a Django model that automatically populates itself when you create an object in the database.
Say you’re creating a blog and instead of having each post as https://myblog/post/1, you want https://myb...
Read: https://aliceridgway.hashnode.dev/django-models-how-to-automatically-populate-slug-fields-for-urls
@django_prog
Django Migrations: how to avoid messing up your database
The language of Django is Python, but the language of relational databases is SQL. So how do you manage your application’s database without having to learn SQL?
What makes Django a powerful web framework is it lets you code all aspects of web server ...
Read: https://aliceridgway.hashnode.dev/django-migrations-how-to-avoid-messing-up-your-database
@django_prog
The language of Django is Python, but the language of relational databases is SQL. So how do you manage your application’s database without having to learn SQL?
What makes Django a powerful web framework is it lets you code all aspects of web server ...
Read: https://aliceridgway.hashnode.dev/django-migrations-how-to-avoid-messing-up-your-database
@django_prog
How to add Tags to your Blog (ManyToManyField Example)
In this tutorial, I am going to show you how to add tags to basic Django blog using a ManyToManyField.
Blogs are a common project used in beginner’s tutorials. This tutorial by Django Girls is one of my favourites, which has instructions on how build...
Read: https://aliceridgway.hashnode.dev/how-to-add-tags-to-your-blog-manytomanyfield-example
@django_prog
In this tutorial, I am going to show you how to add tags to basic Django blog using a ManyToManyField.
Blogs are a common project used in beginner’s tutorials. This tutorial by Django Girls is one of my favourites, which has instructions on how build...
Read: https://aliceridgway.hashnode.dev/how-to-add-tags-to-your-blog-manytomanyfield-example
@django_prog
CRUD Examples with Function Based Views
Learning how to CRUD data is a core skill for any web developer. CRUD stands for Create, Read, Update, Delete.
In this tutorial, I am going to the use the example of building a blogging app in Django. I am going to show you the code to create blog po...
Read: https://aliceridgway.hashnode.dev/crud-examples-with-function-based-views
@django_prog
Learning how to CRUD data is a core skill for any web developer. CRUD stands for Create, Read, Update, Delete.
In this tutorial, I am going to the use the example of building a blogging app in Django. I am going to show you the code to create blog po...
Read: https://aliceridgway.hashnode.dev/crud-examples-with-function-based-views
@django_prog
Django Foreign Key Example - How to Add Categories to a Blog
Foreign keys give you the power to link the tables in the database as you see fit, but they can be confusing at first.
In a previous post, we went through how to use Foreign Keys.
Today, I’m going to go through a full example of how you can add a For...
Read: https://aliceridgway.hashnode.dev/django-foreign-key-example-how-to-add-categories-to-a-blog
@django_prog
Foreign keys give you the power to link the tables in the database as you see fit, but they can be confusing at first.
In a previous post, we went through how to use Foreign Keys.
Today, I’m going to go through a full example of how you can add a For...
Read: https://aliceridgway.hashnode.dev/django-foreign-key-example-how-to-add-categories-to-a-blog
@django_prog
How to create a base template for your Django project
Django templates store the HTML for your projects. Django uses its own templating language to allow you to add data from the back-end into your pages.
Each page of your app will have its own template file but many pages will share some elements like ...
Read: https://aliceridgway.hashnode.dev/how-to-create-a-base-template-for-your-django-project
@django_prog
Django templates store the HTML for your projects. Django uses its own templating language to allow you to add data from the back-end into your pages.
Each page of your app will have its own template file but many pages will share some elements like ...
Read: https://aliceridgway.hashnode.dev/how-to-create-a-base-template-for-your-django-project
@django_prog
How to make a Foreign Key field non-nullable with a default
To make a foreign key field in Django non-nullable, you need to provide a default value for the existing rows. You might want to also provide a default value for new rows. Adding a default is easy when the value is a string or a date, but not when yo...
Read: https://aliceridgway.hashnode.dev/how-to-make-a-foreign-key-field-non-nullable-with-a-default
@django_prog
To make a foreign key field in Django non-nullable, you need to provide a default value for the existing rows. You might want to also provide a default value for new rows. Adding a default is easy when the value is a string or a date, but not when yo...
Read: https://aliceridgway.hashnode.dev/how-to-make-a-foreign-key-field-non-nullable-with-a-default
@django_prog
How to upload images in Django with Pillow (blog example)
A common feature of Django projects is the ability to upload images. I’m going to show you an example where we add feature images to a blogging application.
For this tutorial, I’m going to assume you already have a project to add images to. If not, y...
Read: https://aliceridgway.hashnode.dev/how-to-upload-images-in-django-with-pillow-blog-example
@django_prog
A common feature of Django projects is the ability to upload images. I’m going to show you an example where we add feature images to a blogging application.
For this tutorial, I’m going to assume you already have a project to add images to. If not, y...
Read: https://aliceridgway.hashnode.dev/how-to-upload-images-in-django-with-pillow-blog-example
@django_prog
How To Resize Images For Your Django Project using Pillow (Blog Example)
As a Django developer, you might want to prevent users from uploading large images.
If the uploaded images are wider than the container they will be displayed in, then they are too big. For you, the developer, it means having to pay for more storage....
Read: https://aliceridgway.hashnode.dev/how-to-resize-images-for-your-django-project-using-pillow-blog-example
@django_prog
As a Django developer, you might want to prevent users from uploading large images.
If the uploaded images are wider than the container they will be displayed in, then they are too big. For you, the developer, it means having to pay for more storage....
Read: https://aliceridgway.hashnode.dev/how-to-resize-images-for-your-django-project-using-pillow-blog-example
@django_prog
To Do List: Part 8 - Filtering Tasks
In this tutorial, we are going to implement a basic filter.
This will work by specifying how we want to filter our tasks in the URL and display the filtered data set by loading a new page.
The advantage of this approach is you won't need to write any...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-8-filtering-tasks
@django_prog
In this tutorial, we are going to implement a basic filter.
This will work by specifying how we want to filter our tasks in the URL and display the filtered data set by loading a new page.
The advantage of this approach is you won't need to write any...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-8-filtering-tasks
@django_prog
To Do List - Part 7: Deleting Tasks
Welcome to Part 7 of my tutorial series on how to create a To Do List app with Django. The tutorial series so far has covered models, views, forms, templates and updating tasks.
In this part, we will cover deleting tasks. Users will be able to remove...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-7-deleting-tasks
@django_prog
Welcome to Part 7 of my tutorial series on how to create a To Do List app with Django. The tutorial series so far has covered models, views, forms, templates and updating tasks.
In this part, we will cover deleting tasks. Users will be able to remove...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-7-deleting-tasks
@django_prog
To Do List - Part 6: Edit Objects
In the previous tutorials, we have been building a To Do list app.
We created a page that lists all the tasks and added a form so that the user can add their own.
In the previous tutorial, we made improvements to our templates. Here, we added buttons...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-6-edit-objects
@django_prog
In the previous tutorials, we have been building a To Do list app.
We created a page that lists all the tasks and added a form so that the user can add their own.
In the previous tutorial, we made improvements to our templates. Here, we added buttons...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-6-edit-objects
@django_prog
To Do List - Part 5: Improve the UI
Welcome to Part 5 of my tutorial series on creating a To Do list app with Django.
In Parts 1 to 4, we focused on adding functionality to our app. In this part, we will focus on building out the UI. We will improve the layout. In Parts 6, 7 and 8, we ...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-5-improve-the-ui
@django_prog
Welcome to Part 5 of my tutorial series on creating a To Do list app with Django.
In Parts 1 to 4, we focused on adding functionality to our app. In this part, we will focus on building out the UI. We will improve the layout. In Parts 6, 7 and 8, we ...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-5-improve-the-ui
@django_prog
To Do List - Part 4: Adding a form
Welcome to Part 4 of my tutorial series on building a To Do List app with Django. In the previous tutorial, we added views to process requests from the user. In this tutorial, we will create a form that will let users submit new tasks for their To Do...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-4-adding-a-form
@django_prog
Welcome to Part 4 of my tutorial series on building a To Do List app with Django. In the previous tutorial, we added views to process requests from the user. In this tutorial, we will create a form that will let users submit new tasks for their To Do...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-4-adding-a-form
@django_prog
To Do List - Part 3: URLs, Views & Templates
Welcome to Part 3 of my tutorial series to build a To Do list app. In the previous tutorial we added a model. This means we have a table in the database to store data but we need a way for our users to interact with it.
In this tutorial, we are going...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-3-urls-views-templates
@django_prog
Welcome to Part 3 of my tutorial series to build a To Do list app. In the previous tutorial we added a model. This means we have a table in the database to store data but we need a way for our users to interact with it.
In this tutorial, we are going...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-3-urls-views-templates
@django_prog
To Do List - Part 2: Apps & Models
Welcome to Part 2 of my To-Do list tutorial series.
In Part 1, we set up a Django project with a database and created a user. In this tutorial, we going to create a model, which will be used to create a table in our database.
This is what we are goin...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-2-apps-models
@django_prog
Welcome to Part 2 of my To-Do list tutorial series.
In Part 1, we set up a Django project with a database and created a user. In this tutorial, we going to create a model, which will be used to create a table in our database.
This is what we are goin...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-2-apps-models
@django_prog
To Do List - Part 1: Installing Django
This tutorial is part of a series on creating a To Do List app. If you just want to start up a new Django project, you're in the right place.
This tutorial is going to cover how to start a new Django project.
These are the steps we’re going to take t...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-1-installing-django
@django_prog
This tutorial is part of a series on creating a To Do List app. If you just want to start up a new Django project, you're in the right place.
This tutorial is going to cover how to start a new Django project.
These are the steps we’re going to take t...
Read: https://aliceridgway.hashnode.dev/to-do-list-part-1-installing-django
@django_prog
Tutorial: Create a To Do List App
This is a beginner friendly Django tutorial to create a To Do list app.
This will teach you how to start a Django project from scratch. You will learn how to Create, Read, Update and Delete (CRUD) data from a SQLite database and build a website that ...
Read: https://aliceridgway.hashnode.dev/tutorial-create-a-to-do-list-app
@django_prog
This is a beginner friendly Django tutorial to create a To Do list app.
This will teach you how to start a Django project from scratch. You will learn how to Create, Read, Update and Delete (CRUD) data from a SQLite database and build a website that ...
Read: https://aliceridgway.hashnode.dev/tutorial-create-a-to-do-list-app
@django_prog
How To Resize Images For Your Django Project using Pillow (Blog Example)
As a Django developer, you might want to prevent users from uploading large images.
If the uploaded images are wider than the container they will be displayed in, then they are too big. For you, the developer, it means having to pay for more storage....
Read: https://aliceridgway.hashnode.dev/how-to-resize-images-for-your-django-project-using-pillow-blog-example-1
@django_prog
As a Django developer, you might want to prevent users from uploading large images.
If the uploaded images are wider than the container they will be displayed in, then they are too big. For you, the developer, it means having to pay for more storage....
Read: https://aliceridgway.hashnode.dev/how-to-resize-images-for-your-django-project-using-pillow-blog-example-1
@django_prog