-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
offtopicnames active attribute and support for PUT and PATCH request #508
Conversation
…NameListSerializer.
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.
This looks great! A small comment. Nice use of Walrus.
@RohanJnr thanks for the docstring update. There's currently an error in CI due to conflicting migrations: CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0070_auto_20210519_0545, 0071_increase_message_content_4000 in api).
20
To fix them run 'python manage.py makemigrations --merge' Could you look into fixing this? It also seems the branch needs to be updated. |
Looks like I forgot to push the new commits, haha. Will do when I am at my pc tmw 👍 |
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 like this. I have a few questions, but apart from that, I like this.
Thanks for the review again @jchristgit :D, I will work on them asap. |
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.
Solid work. Thank you!
One minor suggestion for the future: Instead of using the autogenerated names by Django for migrations (like auto_20210519_0545
), it's nice to have a short name describing the migration.
The fix for this was the 0072_merge migration I see correct? Do want to give |
Yes
I think due to the dependencies of the other migrations on this migration this will get a bit hairy, unfortunately :( |
f3964c3
to
1261efd
Compare
The behaviour of the PATCH/PUT method is a little unexpected. You can send a request to That said when using PATCH correctly it worked nicely and made the names no longer show up when specifying |
Practically, The |
What is unexpected is the fact that you can create a new off-topic-name by PUTting (this is primarily what I tried, don't remember if it works the same with PATCH) to an existing off-topic-name. I don't really understand what even caused the support for these new methods as it is done implicitly by Django so I am not sure how much it would take to change this behaviour. |
My comment above applies to PUT also. The reason for the creation of a new
object is django behaviour towards primary keys. This is from the docs:
`The primary key field is read-only. If you change the value of the primary
key on an existing object and then save it, a new object will be created
alongside the old one.`
https://docs.djangoproject.com/en/4.0/ref/models/fields/#primary-key
|
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 what we discussed is fine then if it seems like it would be a lot of code to change it - it's not a big deal. Thanks for this, let's get it merged!
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, wrong project... |
closes #490
linked to python-discord/bot#1568
Changes
active
for OffTopicName.active
attribute of OffTopicName.