djangocameroon / website_api

Django Cameroon Website API
https://beta.api.djangocameroon.site
MIT License
5 stars 2 forks source link

setting the blogging app #23

Open yokwejuste opened 3 months ago

yokwejuste commented 3 months ago

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:

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:

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:

Edmond22-prog commented 3 months ago

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

Edmond22-prog commented 3 months ago

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 commented 3 months ago

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

Edmond22-prog commented 3 months ago

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

yokwejuste commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 1 month ago

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

yokwejuste commented 1 month ago

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

No, @saahndongransom.

Appropriate permissions will be given inline with that.