In this four-part tutorial series, youâre building a social network with Django that you can showcase in your portfolio. This project will strengthen your understanding of relationships between Django models and show you how to use forms so that users can interact with your app and with each other. Youâll also make your Django front end look good by using the Bulma CSS framework.
In the first part, you extended the Django User
model to add profile information that allows users to follow and unfollow each other. You also learned how to customize the Django admin interface and troubleshoot during development with the help of Djangoâs error messages.
In the second part of this tutorial series, youâll learn how to:
- Integrate Bulma CSS and style your app
- Use template inheritance to reduce repetition
- Structure Django templates in a folder hierarchy
- Build routing and view functions
- Interlink pages of your app using dynamic URLs
After finishing the second part of this project, youâll move on to the third part of this tutorial series, where youâll create the back end for adding content to your social network. Youâll also add the missing templates to allow your users to view the text-based content on their dashboard page.
You can download the code that youâll need to start the second part of this project by clicking the link below and going to the source_code_start/
folder:
Get Source Code: Click here to get the source code for this part of building out your Django social network.
Demo
In this four-part tutorial series, youâre building a small social network that allows users to post short text-based messages. The users of your app can also follow other user profiles to see the posts of these users or unfollow them to stop seeing their text-based posts:
In the second part of this series, youâll work with templates and learn to use the CSS framework Bulma to give your app a user-friendly appearance. Youâll also tackle common tasks such as setting up routing, views, and templates for individual user profile pages as well as interlinking them with the profile list page:
At the end of this part of the tutorial series, youâll be able to access detail pages and the profile list page and navigate between them. Youâll also have Bulma added to style the pages.
Project Overview
In this section, youâll get an overview of the topics that youâll cover in this second part of the tutorial series. Youâll also get a chance to revisit the full project implementation steps, in case you need to skip back to a previous step from an earlier part of the series or if you want to see whatâs still up ahead.
At this point, you should have finished working through part one of this tutorial series. If you did, then youâre ready to continue with your next steps, which focus on templates and front-end styling:
 |  |
---|---|
Step 4 | Create a Base Template With Bulma |
Step 5 | List All User Profiles |
Step 6 | Access Individual Profile Pages |
After completing all steps of this second part of the series, you can continue with part three.
To refresh your memory and get an overview of how youâll work through all four parts of this series on building your Django social network, you can expand the collapsible section below:
Youâre implementing the project in a number of steps spread out over multiple separate tutorials in this series. Thereâs a lot to cover, and youâre going into detail along the way:
â Part 1: Models and Relationships
- Step 1: Set Up the Base Project
- Step 2: Extend the Django User Model
- Step 3: Implement a Post-Save Hook
ð Part 2: Templates and Front-End Styling
- Step 4: Create a Base Template With Bulma
- Step 5: List All User Profiles
- Step 6: Access Individual Profile Pages
â Part 3: Follows and Dweets
- Step 7: Follow and Unfollow Other Profiles
- Step 8: Create the Back-End Logic For Dweets
- Step 9: Display Dweets on the Front End
â Part 4: Forms and Submissions
- Step 10: Submit Dweets Through a Django Form
- Step 11: Prevent Double Submissions and Handle Errors
- Step 12: Improve the Front-End User Experience
Each of these steps will provide links to any necessary resources. By approaching the steps one at a time, youâll have the opportunity to pause and come back at a later point in case you want to take a break.
With the high-level structure of this tutorial series in mind, youâve got a good idea of where youâre at and which implementation steps youâll handle in the later parts.
Before getting started with the next step, take a quick look at the prerequisites to skim any links to other resources that might be helpful along the way.
Prerequisites
To successfully work through this part of your project, you need to have completed the first part on models and relationships and you should confirm that your project is working as described there. It would be best if youâre also comfortable with the following concepts:
- Using object-oriented programming in Python
- Setting up a basic Django project
- Managing routing and redirects, view functions, templates, models, and migrations in Django
- Using and customizing the Django admin interface
- Reading and writing HTML with class attributes
Read the full article at https://realpython.com/django-social-front-end-2/ »
[ Improve Your Python With ð Python Tricks ð â Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]
Planet Python