Skip to content

ahmedradwan21/Blog_APP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Blog Application with Advanced Features

This Markdown document provides an in-depth explanation of a Django web application for managing blog posts and user authentication. The application includes various views, models, and forms to enable users to create, view, and manage blog posts.

Table of Contents

What This App Provides for Any User

This Django blog application offers a range of features and functionalities for both registered and non-registered users:

  1. View Blog Posts: Users, whether registered or not, can browse and read published blog posts. This allows anyone to access and consume the content without the need for registration.

  2. Commenting: Non-registered users can view and add comments to published blog posts. This encourages interaction and engagement with the content.

  3. User Registration: For those who want to actively participate, user registration is available. This process is simple and straightforward, requiring basic information.

  4. User Login: Registered users can log in securely to access additional features and functionality, such as creating new blog posts and managing their own content.

  5. Password Change: Registered users have the ability to change their passwords for enhanced security. The built-in password change functionality ensures that users can update their login credentials easily.

  6. Restricted Actions: Certain actions, such as creating, editing, or deleting blog posts, are restricted to authorized users based on their group memberships and permissions. Superusers have elevated access.

  7. Customized User Groups: User registration includes an option to assign users to different groups, providing flexibility in defining roles and permissions.

  8. User Feedback: The application utilizes Django's messages module to provide informative feedback to users, including success and error messages during various interactions.

  9. Advanced Blog Management: Registered users with appropriate permissions can create, edit, and delete their own blog posts, as well as manage comments associated with their posts.

  10. Publication Status: Authors have control over the publication status of their blog posts, allowing them to draft content before publishing.

  11. Search and Filter: Users can search for specific content and filter published blog posts based on keywords or other criteria.

  12. Viewing Comments: Registered users can view comments on their own blog posts, fostering engagement with the audience.

  13. User-Friendly UI: The application features a user-friendly interface with forms for easy content creation and interaction.

Authentication and Permissions

The application implements custom permission checks for users based on their group memberships and superuser status:

  • user_is_member(user): Checks if a user belongs to the "Member" group or is a superuser.
  • user_is_viewer(user): Checks if a user belongs to the "Viewer" group or is a superuser.

Views

blog_post_list(request)

Displays a list of blog posts for the currently logged-in user.

register(request)

Allows users to register for an account. Utilizes the UserCreationForm for user registration. Users can be assigned to different groups during registration.

user_login(request)

Handles user login using the AuthenticationForm.

not_allowed(request)

Renders a page indicating that the user doesn't have permission for certain actions.

create_blog_post(request)

Allows authorized users to create new blog posts. Handles the creation of blog posts, including specifying the publication status.

view_blog_post(request, post_id)

Displays the details of a specific blog post, including any associated comments.

add_comment(request, post_id)

Allows users to add comments to a specific blog post.

publish_blog_post(request)

Displays a list of published blog posts. Supports query-based filtering of blog posts.

delete_blog_post(request, post_id)

Deletes a specific blog post.

update_blog_post(request, post_id)

Allows authorized users to update an existing blog post.

password_change(request)

Provides a form for users to change their passwords. Utilizes Django's PasswordChangeForm for password change functionality. Ensures the session's authentication hash is updated for security.

Models

The application uses Django models to define the structure of the database tables:

  • BlogPost: Stores information about blog posts, including title, content, author, publication date, draft status, and publish status.
  • Comment: Stores comments associated with blog posts.

Forms

  • BlogPostForm: Used for creating and updating blog posts.
  • UserCreationForm and AuthenticationForm: Provided by Django for user registration and login, respectively.

Messages

  • The messages module from Django is used to display success and error messages to users.

Password Change

  • The password_change view allows authenticated users to change their passwords.
  • Utilizes Django's built-in PasswordChangeForm.
  • Ensures that the session's authentication hash is updated after a successful password change.

URL Routing

Please note that the provided code does not include URL patterns (routing). You should define URL patterns in your Django project's urls.py file to map these views to specific URLs and make the application accessible to users.

This comprehensive set of features ensures that both registered and non-registered users can benefit from the content and functionality of the blog application. It promotes user engagement, content creation, and seamless interaction within the platform.

About

Blog_App with simple (Html & css), and login, register , permission , crub , change password, comment , publish, draft, search (-_-) and category

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published