Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting the blogging app #23

Closed
yokwejuste opened this issue Mar 24, 2024 · 9 comments · Fixed by #35 · May be fixed by #31
Closed

setting the blogging app #23

yokwejuste opened this issue Mar 24, 2024 · 9 comments · Fixed by #35 · May be fixed by #31

Comments

@yokwejuste
Copy link
Member

Implement Blog Post App with Full Functionality

We need to add a new app named blog to our Django project that will manage blog posts, including their creation, update, and deletion. This app should handle various aspects such as permissions, serialization of data, and efficient handling of related models and media files. Detailed requirements for each component are outlined below:

Models

Implement the following models with the specified fields:

  • Tags: For categorizing posts. Fields: name.
  • Images: To store image files related to blog posts. Fields: image_file, uploaded_at, blog_post (ForeignKey to Blogs).
  • Blogs: Main model for blog posts. Fields: title, content, created_at, updated_at, author (ForeignKey to Authors), categories (ManyToMany with Categories), tags (ManyToMany with Tags).
  • Categories: For broader categorization of posts. Fields: name.
  • Authors: To credit the author of the post. Fields: name, bio.

Permissions

Set up permissions to ensure that only authorized users can create, update, or delete blog posts. Consider using Django's built-in permissions and custom group-based permissions.

Serializers

Create serializers for each model to facilitate the creation, serialization, and deserialization of JSON data for API responses and requests. Ensure that the serializers handle relations appropriately, especially for the ManyToMany and ForeignKey fields.

Views

Develop the views to handle API requests for blog posts, including:

  • Listing all blog posts
  • Retrieving a single blog post details
  • Creating new blog posts
  • Updating existing blog posts
  • Deleting blog posts

Consider using Django REST Framework's generic views for simplicity and efficiency.

Pre-delete Signals for Images

Implement pre-delete signals for the Images model to ensure that image files are properly deleted from the storage when the corresponding image object is deleted from the database.

Queue for Image/Media Upload

Set up a queue with celery for handling image/media uploads asynchronously to improve performance and user experience. This is especially important for high-traffic sites or when processing large files.

Additionally:

  • Ensure all models are registered in the Django admin for easy management.
  • Write unit tests for models, views, and serializers to ensure reliability.
  • Documentation for API endpoints should be provided for frontend developers.
@Edmond22-prog
Copy link
Member

About models, which field will we use for the content of a blog

@Edmond22-prog
Copy link
Member

Edmond22-prog commented Mar 30, 2024

The author of a post is a user, no?

As for now we won't post on the behalf of someone, so the author of the post is the current logged in user. You can easily get it using something like:

    author = request.user

Passing the access token in the header

@Edmond22-prog
Copy link
Member

So everybody who is user in our website, can create a post article?

@Edmond22-prog
Copy link
Member

In addition, I really don't see the point of making a Celery queue just to upload an image.

@yokwejuste
Copy link
Member Author

About models, which field will we use for the content of a blog

I think we can go with a text field. Something like:

class Blog(...):
    #...
   content = models.TextField()
   #....

@yokwejuste
Copy link
Member Author

In addition, I really don't see the point of making a Celery queue just to upload an image.

Maybe for now we can keep it low, and move on with a light weighted version for this functionality

@yokwejuste
Copy link
Member Author

So everybody who is user in our website, can create a post article?

We will use a custom model as well as built-in Group permission based access and some features from the permission mixins

@saahndongransom
Copy link
Contributor

So everybody who is user in this website, can create a post article?

@yokwejuste
Copy link
Member Author

So everybody who is user in this website, can create a post article?

No, @saahndongransom.

Appropriate permissions will be given inline with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
3 participants