-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Prepopulate modeladmin's datetime fields using querystrings. fixes #19431 #589
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
Prepopulate modeladmin's datetime fields using querystrings. fixes #19431 #589
Conversation
django/contrib/admin/options.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.
Why not, what's the problem supporting "/"?
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 you can have problems supporting "/" inside a URL if we don't encode it.
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.
If the user enters it it's the job of the browser to escape it, otherwise the programmer has to take care of escaping, I don't see why it shouldn't work.
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.
Working on the tests I realized that it was my fault: I was using a wrong date format.
Misses tests! |
I didn't add tests here because I couldn't find any tests related to this feature, and I'm not sure where I could add this. |
tests/regressiontests/admin_views sounds like a good place to add some. |
I fixed the things you commented @apollo13, and added some tests. Please let me know if there's something I can improve there. |
@pyriku I have to check if we want to support localized input or just ISO-format strings. One thing to be changed is that you shouldn't use settings.DATETIME_INPUT_FORMATS but the value from the current activate locale. |
…o improves tests for being more atomic and precise
I'd like to add some documentation, but I wasn't able to find where it's this feature documented. |
(patch does not currently apply cleanly) |
Conflicts: django/contrib/admin/options.py
Conflicts solved, sorry about it. |
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 would put this on 1 line -- it's okay to have longer lines if it helps readability
If you can update this, please squash commits and follow our commit message guidelines (include ticket number and commit message in past tense). Thanks! |
Closing due to inactivity, please send a new PR if you can update it, thanks! |
Related to https://code.djangoproject.com/ticket/19431