-
Notifications
You must be signed in to change notification settings - Fork 4
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
Comments
About models, which field will we use for the |
The 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 |
So everybody who is user in our website, can create a post article? |
In addition, I really don't see the point of making a Celery queue just to upload an image. |
I think we can go with a text field. Something like: class Blog(...):
#...
content = models.TextField()
#.... |
Maybe for now we can keep it low, and move on with a light weighted version for this functionality |
We will use a custom model as well as built-in Group permission based access and some features from the permission mixins |
So everybody who is user in this website, can create a post article? |
No, @saahndongransom. Appropriate permissions will be given inline with that. |
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:
name
.image_file
,uploaded_at
,blog_post
(ForeignKey to Blogs).title
,content
,created_at
,updated_at
,author
(ForeignKey to Authors),categories
(ManyToMany with Categories),tags
(ManyToMany with Tags).name
.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:
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:
The text was updated successfully, but these errors were encountered: