Skip to content

Conversation

@cb109
Copy link
Owner

@cb109 cb109 commented Jan 8, 2022

No description provided.

cb109 added 30 commits June 23, 2018 00:54
Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Worth considering. View full project report here.



class PurchaseWeight(TimestampMixin, models.Model):
purchase = models.ForeignKey("purchases.Purchase", on_delete=models.CASCADE)

Choose a reason for hiding this comment

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

Django automatically creates a related_name if it's not set. If it were set then a more readable and explicit relationship is set up. More details.


class PurchaseWeight(TimestampMixin, models.Model):
purchase = models.ForeignKey("purchases.Purchase", on_delete=models.CASCADE)
member = models.ForeignKey("auth.User", on_delete=models.CASCADE)

Choose a reason for hiding this comment

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

Again, with an explicit related_name would be better.

Copy link

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Worth considering. View full project report here.

user_id = obj["user__id"]
filepath = os.path.join(
output_dir,
"{0}{1}".format(user_id, ext),

Choose a reason for hiding this comment

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

f-string is easier to read, write, and less computationally expensive than legacy string formatting. Read more.

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