-
Notifications
You must be signed in to change notification settings - Fork 0
Notifications #17
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
Notifications #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One commit message is too long, please just rewrite the message.
Very good work! Just some rewrite of the view on the get_object_or_404() in particular, i was perplexe at the begining but the correction seems good to me! The final is just as i love! ;)
api/serializers.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to remove this field in the serializer and just put the actual user in the created_by field when the task is created to not allow edition on this field.
For the moment i can call the API to say the creator is an other guy because the get_initial() function of the view just populate field if is not already given (say me if i'm wrong)
PS: I think we can made this population of the field in the serializer with the create function. Or if is not possible with a signal on the model when create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The create function requires the context to have the logged in user. Instead, In my new commit, I enforce the user inside the view class.
5db61d3 to
621623a
Compare
|
@RignonNoel I enforced the user to be always set with the |
|
Oh sorry i've miss you're last commits! |
RignonNoel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix seems good to me! I'm just not sure with the blank attribute on created_by but it's not a big deal, it's just we can add a bad tasks if we create a new view and forget this steps.
| User, | ||
| verbose_name='Created by', | ||
| related_name='task_created', | ||
| blank=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure with this line. I think it may be good to have this field required.
A new /notification endpoint was added and is coming with:
For now, notifications only exists when a tasks is created. They're automatically generated via a signal "post_save" at the end of
models.py