Demystifying Django: A Comprehensive Guide to Python's Powerful Web Framework
Adeel Ahmed ? Software Engineer
Web Application Developer | Back-end Development | Front-end Development, Dev/Ops Engineer, Agile Methodology | I Help Companies Build Innovative Web Applications | Django React Dev
Introduction
In the fast-paced realm of web development, having a robust and flexible framework is essential to transform creative ideas into functional, user-friendly websites and applications. This is where Django, the high-level Python web framework, steps into the spotlight.
Django is not just another tool in the web developer's toolbox; it's a powerhouse that simplifies the complexities of web development while promoting best practices and maintainability. Born out of the needs of newsroom developers at the Lawrence Journal-World newspaper in 2003, Django has evolved into one of the most popular and trusted frameworks for building web applications.
So, what sets Django apart? At its core, Django adheres to the "batteries-included" philosophy, meaning it provides an extensive set of features out of the box, enabling developers to focus on crafting unique and compelling applications rather than reinventing the wheel.
In this article, we will embark on a journey through the Django landscape, exploring its features, architecture, and the myriad possibilities it offers to web developers. Whether you're a newcomer eager to learn the ropes or an experienced developer seeking to harness the full potential of Django, this guide will serve as your compass.
We'll delve into the creation of Django projects and applications, uncover the magic of the Django ORM for database interactions, master URL routing and view handling, tackle forms and user input with ease, and venture into the realms of authentication, authorization, and RESTful API development.
Django also boasts a powerful and customizable admin panel, making it a favorite choice for content management systems (CMS) and internal tools. We'll explore how to leverage this feature to simplify data management tasks.
Throughout our journey, we'll emphasize best practices, offer practical examples, and provide tips and tricks to help you become a Django virtuoso. By the end of this article, you'll be well-equipped to start your Django-powered projects, whether they involve building dynamic websites, APIs, or more.
Django is more than a framework; it's a community-driven ecosystem that fosters collaboration and innovation. As you dive into Django development, you'll discover a vibrant community, extensive documentation, and a wealth of third-party packages to extend your capabilities further.
So, fasten your seatbelt and get ready to embark on a thrilling exploration of Django's capabilities. Whether you're a curious newcomer or an experienced coder, Django has something to offer you in your web development journey. Let's dive into the world of Django and unlock its potential.
What is Django?
Django is a high-level Python web framework that facilitates the rapid development of web applications. It is open-source, free, and follows the Model-View-Controller (MVC) architectural pattern, although in Django, it's often referred to as Model-View-Template (MVT). Django's primary goal is to simplify the process of building complex, database-driven websites by promoting reusability, less code redundancy, and a clean, pragmatic design.
Key features and components of Django include:
Creating a Django Project
Creating a Django project is the first step in getting started with Django web development. In this section, I'll walk you through the process of creating a Django project. Before you begin, ensure that you have Django installed on your system. If not, you can install it using pip:
pip install Django
Once Django is installed, follow these steps to create a new Django project:
Step 1: Choose a Project Name
Choose a descriptive name for your Django project. This name will be used for the project directory and is often used as part of the Python package name for your project.
Step 2: Create a Django Project
Open your terminal or command prompt and navigate to the directory where you want to create your Django project. Then, run the following command, replacing "projectname" with your chosen project name:
django-admin startproject projectname
For example, if you want to create a project called "mywebsite," you would run:
django-admin startproject mywebsite
This command will create a new directory with your project name (in this case, "mywebsite") and the following files and directories inside it:
mywebsite/
manage.py
mywebsite/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
Let's briefly explain these files and directories:
- manage.py: This is a command-line utility for managing various aspects of your Django project, such as running the development server, creating database tables, and more.
- mywebsite/ (the inner directory): This is the Python package for your project. It contains settings, URL routing, and other configurations.
- __init__.py: This file is empty and tells Python that this directory should be treated as a Python package.
- settings.py: This file contains project settings, including database configuration, installed apps, and other project-specific settings.
- urls.py: This file defines the URL patterns for your project, mapping URLs to view functions.
- asgi.py and wsgi.py: These files are used for ASGI and WSGI deployments, which are server interfaces for hosting Django applications. You typically don't need to modify them during the initial setup.
Step 3: Configure Your Project
Open the settings.py file inside the mywebsite directory and configure your project settings. Pay attention to database settings, installed apps, and other configurations specific to your project.
Step 4: Run the Development Server
To test your newly created project, run the development server by executing the following command from the project directory:
python manage.py runserver
This will start the development server, and you should see output indicating that the server is running. By default, it will listen on https://127.0.0.1:8000/ (localhost) in your web browser.
Step 5: Access the Admin Panel (Optional)
Django's admin panel is a powerful tool for managing your application's data. To access it, you'll need to create a superuser account. Run the following command:
python manage.py createsuperuser
Follow the prompts to create an admin account with a username, email, and password. Once the superuser is created, you can access the admin panel at https://127.0.0.1:8000/admin/ and log in with the superuser credentials.
That's it! You've successfully created a Django project. You can now start building your web application by creating Django apps within this project and defining URL patterns, views, models, and templates as needed for your project's functionality.
Building Django Applications
Building Django applications is an essential part of web development using the Django framework. Django applications are modular components that encapsulate specific features or functionalities within a project. In this section, I'll guide you through the process of creating and building Django applications.
Step 1: Create a Django Application
To create a Django application, follow these steps:
1. Open your terminal or command prompt.
2. Navigate to the root directory of your Django project (the directory containing manage.py).
3. Run the following command, replacing "appname" with your chosen application name:
python manage.py startapp appname
For example, if you want to create an application called "blog," you would run:
python manage.py startapp blog
This command will generate a new directory for your application with the following structure:
appname/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
Now that you have created your Django application, let's explore each of these files and their purposes:
- __init__.py: This empty file tells Python that the directory should be treated as a Python package.
- admin.py: This file is used to define the admin interface for your application. You can register your models here to manage them through the Django admin panel.
- apps.py: This file contains the application configuration. You can customize application-specific settings here if needed.
- migrations/: This directory stores database migration files, which are generated when you create or modify models. Migrations help you manage changes to the database schema over time.
- models.py: This is where you define the data models for your application using Django's Object-Relational Mapping (ORM). Models define the structure of your database tables.
- tests.py: You can write unit tests for your application's functionality in this file.
- views.py: This is where you define view functions that handle HTTP requests and return responses. Views determine how data is presented to users.
Step 2: Define Models
In your application's models.py file, define the data models that represent the objects your application will work with. Django's ORM allows you to define models as Python classes, and it automatically generates the database schema based on these models.
For example, if you were building a blog application, you might define a Post model with fields like title, content, author, and timestamp.
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
author = models.ForeignKey(User, on_delete=models.CASCADE)
timestamp = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
Step 3: Create and Apply Migrations
After defining your models, you need to create and apply migrations to update the database schema. Run the following commands:
python manage.py makemigrations appname
python manage.py migrate
Replace "appname" with the name of your application (e.g., "blog").
Step 4: Create Views
In your application's views.py file, define view functions that handle HTTP requests and return responses. Views determine what content is displayed to users.
For example, you can create a view function to list all blog posts:
from django.shortcuts import render
from .models import Post
def post_list(request):
posts = Post.objects.all()
return render(request, 'blog/post_list.html', {'posts': posts})
Step 5: Define URLs
To map URLs to your view functions, create a urls.py file in your application directory (if it doesn't already exist) and define URL patterns. For example:
from django.urls import path
from . import views
urlpatterns = [
path('posts/', views.post_list, name='post_list'),
]
Step 6: Configure Templates
Create HTML templates for your views. By default, Django looks for templates in an "appname/templates/appname" directory. For example, for the "blog" app, you can create a template called post_list.html inside "blog/templates/blog/" to render the list of blog posts.
Step 7: Include the Application URLs
In your project's main urls.py (located in the project's root directory), include the URLs of your application using the include function. For example:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')),
]
Now, your Django application is ready to be used within your project. You can continue to add more views, templates, and functionality as needed to build your web application. Don't forget to run the development server (`python manage.py runserver`) to test your application locally as you make changes.
Models and Databases
In Django, models are the heart of your web application's database-driven functionality. Models define the structure of your database tables and allow you to work with data using Python classes. In this section, we'll delve into creating and using models in Django, including how to interact with databases.
Step 1: Define Models
1. Open the models.py file within your Django application (e.g., "blog" or any other app you've created).
2. Define your models as Python classes. Each class represents a database table, and class attributes define the fields of that table. For example, let's create a Post model for a blog application:
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
created_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
In this example:
- Post is the name of the model.
- title, content, author, and created_date are fields of the model.
- models.CharField and models.TextField represent text fields of varying lengths.
- models.ForeignKey establishes a many-to-one relationship with the built-in User model (for post authors).
- models.DateTimeField stores date and time information.
- The __str__ method defines a human-readable representation of a Post object.
Step 2: Create Migrations
Once you've defined your models, you need to create database migrations to update the database schema. Run the following commands:
python manage.py makemigrations
python manage.py migrate
These commands will generate migration files based on your model definitions and apply those migrations to your database. This process ensures that your database schema aligns with your model definitions.
Step 3: Interact with the Database
Now that your models are defined and the database is set up, you can interact with the database using the Django ORM. The ORM allows you to create, read, update, and delete records in the database without writing raw SQL queries.
Here are some common database operations:
- Creating Records:
post = Post(title='My First Post', content='This is the content.', author=user)
post.save()
You can also use the create method:
Post.objects.create(title='Another Post', content='More content.', author=user)
- Querying Records:
# Retrieve all posts
all_posts = Post.objects.all()
# Retrieve a single post by its primary key
post = Post.objects.get(pk=1)
# Filter posts based on conditions
filtered_posts = Post.objects.filter(title__icontains='django')
- Updating Records:
post = Post.objects.get(pk=1)
post.title = 'Updated Title'
post.save()
You can also use the update method for bulk updates:
Post.objects.filter(author=user).update(title='New Title')
- Deleting Records:
post = Post.objects.get(pk=1)
post.delete()
You can also use the delete method with a filter to delete multiple records at once.
These are just some of the basic database operations you can perform with Django models. The Django ORM provides a rich set of tools for working with databases, including complex queries, aggregations, and more.
Step 4: Admin Panel Integration
By default, Django automatically generates an admin interface for your models. To make your models accessible in the admin panel, you'll need to register them in the admin.py file of your application. For example:
from django.contrib import admin
from .models import Post
admin.site.register(Post)
Now, you can use the admin panel to manage your model's data without writing custom administrative views.
By following these steps, you can create, manage, and interact with database tables in Django using models. This approach simplifies database-related tasks, allows for efficient data manipulation, and maintains database schema consistency with your application's logic.
Views and Templates
In Django, views and templates are essential components for handling HTTP requests, processing data, and rendering dynamic web pages. Views handle the business logic of your web application, while templates define the presentation layer. In this section, I'll guide you through creating views and templates in Django.
领英推荐
Step 1: Create Views
Views in Django are Python functions or classes responsible for processing HTTP requests and returning HTTP responses. To create views, follow these steps:
1. Open the views.py file within your Django application (e.g., "blog" or any other app).
2. Define view functions that perform specific tasks. For example, let's create a view to display a list of blog posts:
from django.shortcuts import render
from .models import Post
def post_list(request):
posts = Post.objects.all()
return render(request, 'blog/post_list.html', {'posts': posts})
In this example:
- post_list is the view function's name.
- request is the HTTP request object.
- Post.objects.all() retrieves all blog posts from the database using the Django ORM.
- render is used to render an HTML template (`'blog/post_list.html'`) and pass data (the list of posts) to the template.
Step 2: Create Templates
Templates in Django are HTML files with placeholders for dynamic data. To create templates, follow these steps:
1. Create a directory named templates inside your application directory (if it doesn't already exist). For example, in the "blog" app, create a directory structure like this:
blog/
templates/
2. Inside the templates directory, create another directory with the same name as your app (e.g., "blog"). This will be the app's template directory:
blog/
templates/
blog/
3. Inside the app's template directory, create an HTML file for your view. For example, create a file named post_list.html:
<!DOCTYPE html>
<html>
<head>
<title>Blog Post List</title>
</head>
<body>
<h1>Blog Posts</h1>
<ul>
{% for post in posts %}
<li>{{ post.title }}</li>
{% endfor %}
</ul>
</body>
</html>
In this example:
- {% for post in posts %} and {{ post.title }} are template tags that allow you to loop through the list of posts and display their titles dynamically.
Step 3: Configure URL Routing
To map URLs to your views, you need to define URL patterns. Create a urls.py file in your application directory (e.g., "blog") if it doesn't already exist.
Here's an example of how to define a URL pattern to map the /blog/ URL to the post_list view:
from django.urls import path
from . import views
urlpatterns = [
path('', views.post_list, name='post_list'),
]
In this example:
- An empty path '' means that the view will be associated with the base URL of your app (e.g., /blog/).
- views.post_list specifies the view function to be called when this URL is accessed.
- name='post_list' is a name for the URL pattern, which can be used in templates and other parts of your code.
Step 4: Include App URLs in Project URLs
Finally, you need to include your app's URL patterns in your project's main urls.py. This ties your app's URLs to the project's overall URL configuration.
In your project's urls.py, add an include statement:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')), # Include your app's URLs
]
Now, when you access /blog/ in your web browser, Django will route the request to the post_list view, which will render the post_list.html template with the list of blog posts.
By following these steps, you can create views and templates in Django to handle HTTP requests and render dynamic web pages, allowing you to build interactive and user-friendly web applications.
URL Routing
URL routing in Django is the process of mapping URLs to view functions or classes that handle the associated HTTP requests. Django uses a URL dispatcher to manage this routing, allowing you to define URL patterns and their corresponding views. In this section, I'll guide you through the steps to configure URL routing in Django.
Step 1: Create URLs Configuration for Your App
1. Inside your Django application directory (e.g., "blog" or any other app), create a file named urls.py if it doesn't already exist.
2. In the urls.py file, import the necessary modules and define URL patterns for your app. For example, let's create a URL pattern to display a list of blog posts:
from django.urls import path
from . import views # Import your app's views
urlpatterns = [
path('', views.post_list, name='post_list'),
]
In this example:
- from django.urls import path imports the path function, which is used to define URL patterns.
- from . import views imports the views module from your app.
The urlpatterns list contains URL patterns. In this case, we're defining a pattern for the base URL (an empty string '') that maps to the post_list view from your app's views module. We also assign the name 'post_list' to this URL pattern for easy reference in your templates and views.
Step 2: Include App URLs in the Project URLs
To make your app's URL patterns accessible from the project's main URL configuration, you need to include your app's urls.py file in the project's urls.py. Here's how to do it:
1. In your project's main urls.py (usually located in the project's root directory), import the include function from django.urls.
2. Include your app's URLs by adding a path that specifies a prefix for your app's URLs and uses the include function to include your app's urls.py. For example:
from django.contrib import admin
from django.urls import path, include # Import the include function
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')), # Include your app's URLs
]
In this example:
- The path('blog/', include('blog.urls')) line maps all URLs starting with /blog/ to your app's URL patterns defined in blog.urls. The 'blog/' prefix can be customized to match your app's desired URL structure.
Step 3: Define Views and Templates
Before testing your URL routing, ensure that you have defined the necessary views and templates, as discussed in the previous sections. The views are responsible for processing HTTP requests, and the templates define the HTML presentation.
Step 4: Run the Development Server
Now, you can run the Django development server to test your URL routing. Open your terminal or command prompt, navigate to your project's root directory, and execute the following command:
python manage.py runserver
The development server will start, and you can access your web application in a web browser.
For example, if you followed the above example, you can access the list of blog posts by opening your browser and navigating to https://127.0.0.1:8000/blog/. This URL maps to the post_list view, which renders the associated template.
By configuring URL routing in this way, you can create a structured and organized web application with distinct URL patterns for different views and functionalities, making it easier to maintain and expand your project as it grows.
Forms and User Inputs
In Django, forms play a crucial role in handling user input and data validation. They allow you to create HTML forms easily, validate user-submitted data, and save it to the database. In this section, I'll guide you through creating and using forms for user input in Django.
Step 1: Create a Form Class
1. In your Django application directory (e.g., "blog" or any other app), create a Python file named forms.py if it doesn't already exist.
2. Inside forms.py, import the necessary modules and create a form class by subclassing django.forms.Form. For example, let's create a form for adding new blog posts:
from django import forms
class PostForm(forms.Form):
title = forms.CharField(max_length=200)
content = forms.Textarea()
In this example:
- PostForm is the name of the form class.
- forms.CharField and forms.Textarea are form fields that represent a text input and a textarea input, respectively.
- You can customize form fields by specifying attributes like max_length or adding widget options for more control over HTML rendering.
Step 2: Create a View to Handle the Form
1. In your app's views.py file, import the PostForm class you created in the previous step.
2. Define a view function that handles the form rendering and submission. For example:
from django.shortcuts import render, redirect
from .forms import PostForm
def add_post(request):
if request.method == 'POST':
form = PostForm(request.POST)
if form.is_valid():
# Process and save the form data to the database
# Redirect to a success page or display a success message
return redirect('post_list') # Redirect to the post list view
else:
form = PostForm()
return render(request, 'blog/add_post.html', {'form': form})
In this example:
- The view function add_post checks whether the request method is POST (indicating a form submission) or GET (for displaying the form).
- If it's a POST request, it creates a PostForm instance with the submitted data (`request.POST`) and checks if the form is valid using form.is_valid().
- If the form is valid, you can process the data, save it to the database, and then redirect to another page (e.g., a post list view).
- If it's a GET request, it creates a blank PostForm instance for rendering the form.
Step 3: Create a Template for the Form
1. Create an HTML template for rendering the form. For example, create a file named add_post.html in your app's templates/blog/ directory:
<!DOCTYPE html>
<html>
<head>
<title>Add New Post</title>
</head>
<body>
<h1>Add New Post</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
</body>
</html>
In this example:
- {% csrf_token %} is a security measure to include a CSRF token in the form for protection against cross-site request forgery attacks.
- {{ form.as_p }} renders the form fields as paragraphs, but you can use other template tags like {{ form.as_table }} or {{ form.as_ul }} depending on your preferred rendering style.
Step 4: Configure URL Routing for the Form
In your app's urls.py, create a URL pattern for the add_post view:
from django.urls import path
from . import views
urlpatterns = [
# ... (other URL patterns)
path('add_post/', views.add_post, name='add_post'),
]
Step 5: Test the Form
Run the development server using python manage.py runserver, and navigate to the form page, which is typically located at https://127.0.0.1:8000/blog/add_post/ based on the URL pattern you defined.
You can now use this form to add new blog posts. When you submit the form, the data will be processed by the view, validated, and, if valid, saved to the database. You can customize the form, validation logic, and data processing to fit your application's requirements.
By following these steps, you can create forms in Django to collect and process user input, making your web application interactive and user-friendly.
Django & Rest API
Django is a versatile web framework that can be used to create RESTful APIs (Representational State Transfer Application Programming Interfaces) in addition to building traditional web applications. RESTful APIs are a popular way to enable communication and data exchange between different systems, such as web applications, mobile apps, and external services. In this section, I'll guide you through the process of creating a RESTful API using Django.
Step 1: Set Up Your Django Project
If you haven't already, create a Django project and application by following the steps mentioned earlier in this conversation. Ensure Django is installed and your project is ready.
Step 2: Create a Model
Define the data model that your API will expose. This could be a model representing resources such as articles, users, products, or any other data you want to expose through your API. For example, let's create a simple model for a blog API:
# models.py in your app
from django.db import models
class BlogPost(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
def str(self):
return self.title
After creating the model, run python manage.py makemigrations and python manage.py migrate to apply the database changes.
Step 3: Create a Serializer
Serializers in Django REST framework allow you to convert complex data types, such as Django model instances, into native Python data types. This is necessary to render the data into JSON or other content types. Create a serializer class for your model:
# serializers.py in your app
from rest_framework import serializers
from .models import BlogPost
class BlogPostSerializer(serializers.ModelSerializer):
class Meta:
model = BlogPost
fields = '__all__'
Step 4: Create Views
Next, create views to handle HTTP requests and serve the data through your API. You can use Django REST framework's class-based views or function-based views. Here's an example using function-based views:
# views.py in your app
from rest_framework import generics
from .models import BlogPost
from .serializers import BlogPostSerializer
class BlogPostList(generics.ListCreateAPIView):
queryset = BlogPost.objects.all()
serializer_class = BlogPostSerializer
class BlogPostDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = BlogPost.objects.all()
serializer_class = BlogPostSerializer
These views provide basic CRUD (Create, Read, Update, Delete) functionality for your API.
Step 5: Configure URL Routing
Define URL patterns for your API views in your app's urls.py:
# urls.py in your app
from django.urls import path
from . import views
urlpatterns = [
path('posts/', views.BlogPostList.as_view(), name='blogpost-list'),
path('posts/<int:pk>/', views.BlogPostDetail.as_view(), name='blogpost-detail'),
]
These URL patterns map to the API views you created earlier.
Step 6: Configure Django REST Framework
Make sure you have Django REST Framework installed in your project. If not, you can install it using pip:
pip install djangorestframework
Then, add 'rest_framework' to your project's INSTALLED_APPS list in the settings.py file.
Step 7: Test Your API
With everything set up, you can now start your Django development server:
python manage.py runserver
Your API endpoints will be accessible at URLs like https://127.0.0.1:8000/api/posts/ for listing and creating blog posts, and https://127.0.0.1:8000/api/posts/1/ for retrieving, updating, or deleting a specific post.
Use tools like curl, Postman, or web browser extensions to test your API by sending HTTP requests to these endpoints.
By following these steps, you can create a RESTful API using Django and Django REST Framework to provide data to external clients or integrate your application with other systems.
CONCLUSION
In conclusion, Django is a powerful and versatile web framework that simplifies the development of web applications and RESTful APIs in Python. Throughout this conversation, we've covered various aspects of Django, including:
1. Introduction to Django: We discussed what Django is and its key features, including its focus on rapid development, clean design, and extensive built-in functionality.
2. Creating a Django Project: We walked through the steps to create a new Django project, including setting up the project directory structure and configuring the initial settings.
3. Building Django Applications: We explained how to create Django applications within a project, defining models, views, templates, and URL routing for each application.
4. Models and Databases: We explored how to define data models using Django's Object-Relational Mapping (ORM) and interact with databases, including creating, querying, updating, and deleting records.
5. Views and Templates: We discussed how to create views to handle HTTP requests and templates to define the presentation layer, allowing you to render dynamic web pages.
6. URL Routing: We covered the process of configuring URL routing in Django to map URLs to view functions or classes, making it easier to organize and structure your web application.
7. Forms and User Input: We explained how to create forms in Django to collect and process user input, including defining form classes, creating views, and rendering forms in templates.
8. Django and REST API: We discussed how to create a RESTful API using Django and Django REST Framework, including defining models, serializers, views, and URL patterns to expose data through API endpoints.
Django's robust ecosystem, extensive documentation, and active community make it a popular choice for web development projects of all sizes. Whether you're building a simple website, a complex web application, or a RESTful API, Django provides the tools and conventions to help you develop efficiently and maintainable code.
As you continue to explore Django and its features, you'll discover even more possibilities for creating dynamic and feature-rich web applications. Don't hesitate to consult Django's official documentation and the community for further guidance and best practices as you embark on your Django journey.
???? "Exploring Django and APIs, a dynamic duo in web development! Your post highlights the power of Django in creating robust web applications with efficient APIs. Thanks for sharing your insights and inspiring us to dive deeper into this fantastic framework. Let's continue to innovate and build exceptional digital solutions! ?? Check us more details:?https://www.dhirubhai.net/feed/update/urn:li:activity:7105822744822317057