-
Notifications
You must be signed in to change notification settings - Fork 287
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
Properly handle empty file field #509
Properly handle empty file field #509
Conversation
Local tests passed, the one was failing before:
|
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.
Thanks for the contribution. Looks to me a good change once you fix the test.
tests/test_templatetags.py
Outdated
""" | ||
We can specify the name of a charfield or imagefield on our user model, or a callable that receives our user | ||
""" | ||
custom_jazzmin_settings["user_avatar"] = field | ||
assert jazzmin.get_user_avatar(test_input) == expected | ||
print(caplog.text) |
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.
Can the print message be deleted, please?
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.
Once done there's no reason we can't get this in .
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.
@PavelPancocha You also need to rebase. I've QA'd this now and LGTM to be apart from that you still have dj_database_url
in the test_app. So can you rebase and we can look into merging. Thanks for your help on this.
@jamesgilmorelyst You took over the Jazzmin? Will you be able to merge it if it works? |
@jamesgilmorelyst @farridav please comment, that I know it is not a lost of time to revive this. Thanks! |
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.
LGTM once rebased - comments are optional. Thanks.
tests/test_templatetags.py
Outdated
""" | ||
We can specify the name of a charfield or imagefield on our user model, or a callable that receives our user | ||
""" | ||
custom_jazzmin_settings["user_avatar"] = field | ||
assert jazzmin.get_user_avatar(test_input) == expected | ||
print(caplog.text) |
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.
@PavelPancocha You also need to rebase. I've QA'd this now and LGTM to be apart from that you still have dj_database_url
in the test_app. So can you rebase and we can look into merging. Thanks for your help on this.
if log: | ||
assert log in caplog.text | ||
else: | ||
assert not caplog.text |
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 do love it when I see the logs being tested as well!
Optional - Whats your thoughts on testing log levels (i.e. WARNING
here).
if type(avatar_field) == str: | ||
if avatar_field is not None: | ||
if not avatar_field: | ||
return no_avatar |
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.
Optional - no_avatar
is basically a constant so potentially could be moved outside the function to the top of the file (or to the settings).
Thanks for feedback, great to see this project revived. I will find time to rebase/improve this PR during week! |
3044613
to
f18cd80
Compare
@PacificGilly @farridav Ready :) |
Just Ruff failed for python 3.12 -> it could be formatted differently, but that doesn't work for python 3.8 - so I decided to keep it python 3.8 compatible. Maybe it could be set to always format it for lowest supported version? |
This looks like it's failing on the coveralls job, which is the only one that appears to be running ruff over the tests folder.. so it seems the formatting issue is in there.. Are you sure this build cannot be fixed ? |
@farridav I can remove the typing. |
bb4ced1
to
a61a48f
Compare
a61a48f
to
11ca70e
Compare
@farridav I fixed it, now fails with:
|
Nice.. yes this particular error is with me, I need to make it so that the secret is available for other people.. but that doesn't block this PR as it will work fine in main. Thanks for your contribution |
For anyone else who is still dealing with this warning after upgrading to 3.0.0, your |
Fix: #508