Skip to content
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

Split device template filter into two extra template filters #133

Closed
wants to merge 2 commits into from

Conversation

patimatnazhm
Copy link
Contributor

@patimatnazhm patimatnazhm commented May 20, 2021

Description

In user_sessions/templatetags/user_sessions.py I added two template filters, platform and browser, which are the splitted device template filter.

Motivation and Context

We have faced with the necessity to use name of browser and name of platform in different lines of code. So, as a result of the splitting, there's no longer a need to override the template filter for these purposes. I think that two added above-mentioned filters are a frequent need, especially while HTML coding.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@patimatnazhm patimatnazhm changed the title Split device templatetag into two extra templatetags Split device template filter into two extra template filters May 20, 2021
@@ -1,3 +1,4 @@
.idea/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't include unrelated changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint: You can include this in $HOME/.config/git/ignore and it will be ignored on any local repository.

@register.filter
def browser(value):
"""
Transform a User Agent into human readable text.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the same docstring for all three filters will be confusing, update the docstring to reflect the return value.

Copy link
Collaborator

@Bouke Bouke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to have a few tests for the new filters, to ensure they keep working with future changes.

@blag blag mentioned this pull request Sep 19, 2023
8 tasks
@blag blag closed this in #165 Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants