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

[models] Use hardware_id as string representation if that feature is enabled #112

Merged
merged 1 commit into from
Jul 12, 2019

Conversation

okraits
Copy link
Member

@okraits okraits commented Jun 19, 2019

The hardware_id should be used as the string representation for a device if the hardware_id feature is enabled.

@coveralls
Copy link

coveralls commented Jun 19, 2019

Coverage Status

Coverage increased (+0.005%) to 98.203% when pulling 58f7394 on TDT-AG:tdt-device-string into 51d4cbe on openwisp:master.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

@okraits see my comment

@@ -99,6 +99,12 @@ class Meta(AbstractDevice.Meta):
)
abstract = False

def __str__(self):
if app_settings.HARDWARE_ID_ENABLED:
Copy link
Member

Choose a reason for hiding this comment

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

I'd switch to a oneliner to avoid code coverage decreasing:

return self.hardware_id if app_settings.HARDWARE_ID_ENABLED else self.name

Copy link
Member Author

Choose a reason for hiding this comment

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

@nemesisdesign Thank you for the hint - done! 😀

@okraits
Copy link
Member Author

okraits commented Jul 12, 2019

@nemesisdesign Anything blocking this from a merge?

@nemesifier nemesifier merged commit 88b8a06 into openwisp:master Jul 12, 2019
@nemesifier
Copy link
Member

@okraits thx for reminding me

@okraits okraits deleted the tdt-device-string branch December 2, 2019 08:27
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.

3 participants