You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
Added Serializer and ViewSet for PostComment model in branch
Did not test yet. Clueless about how to do it. I had some questions by the way.
We don't need to create serializer for through relationship classes, do we?
I read documentation of DRF. But bujhlam na ForeignKey/ManyToMany field er jonno ki alada kore serializer likhte hobe naki. Or should I just add HyperLinkedField for them ?
In coreapp/models.py/line 135: PostComment Model
Ekhane PostComment class er sathe Reacts er ManyToMany relationship keno ?
OneToMany/ManyToOne howar kotha na ?
@fazledyn
First of all, PostComment Model has a rough simple design. But we can start with that. Now for your queries,
1&2. You need to use custom serializer for ForeignKey/ManyToMany if you want to have additional fields for that ForeignKey/ManyToMany attribute instead of just primary key.
3. PostComment's reacts is a relation between User & PostComment which is m2m.
But start with a simpler one. For now, implement only comment part just like PostReaction which should return json like:
{
comment: text,
time: comment-time,
user: user-hyperlink like PostReactionSerializer,
post: post-hyperlink like PostReactionSerializer,
}
Try to go thru the following steps for simplicity:
set the nested url acc to this card like PostReaction urls
implement the serializer & viewset to create/edit comments like above setting user/post properly like PostReaction
Handle comment edit permission properly with DRF Permissions
Leave Comment Reaction/Reply parts for now. We will deal that later
Use Postman for testing.
We currently have two users: admin/admin, intruder/123. You can add new user following swagger doc or feel free to use these ones for testing.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Added
Serializer
andViewSet
forPostComment
model in branchDid not test yet. Clueless about how to do it. I had some questions by the way.
We don't need to create serializer for
through
relationship classes, do we?I read documentation of DRF. But bujhlam na ForeignKey/ManyToMany field er jonno ki alada kore serializer likhte hobe naki. Or should I just add
HyperLinkedField
for them ?In
coreapp/models.py/line 135: PostComment Model
Ekhane PostComment class er sathe Reacts er ManyToMany relationship keno ?
OneToMany/ManyToOne howar kotha na ?
Tagging @Subangkar Bhai
The text was updated successfully, but these errors were encountered: