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

Pass ForeignKey kwargs to BaseField #1239

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

booqoffsky
Copy link

@booqoffsky booqoffsky commented Dec 21, 2023

I want to add a comment on the ForeignKey:

class MyModel(ormar.Model):
    model_two: MyAnotherModel = ForeignKey(
        MyAnotherModel,
        ...
        comment="my super comment",
    )

And this does not work due to the fact that the kwargs are not passed to the ForeignKeyField, however, according to the documentation, it should:

:param kwargs: all other args to be populated by BaseField

The proposed code fixes this problem. Could you take a look at it, please?

Copy link

codecov bot commented May 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (5494503) to head (0480531).
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1239   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          204       204           
  Lines        14835     14835           
=========================================
  Hits         14835     14835           
Files Coverage Δ
ormar/fields/foreign_key.py 100.00% <ø> (ø)

Copy link

codspeed-hq bot commented May 26, 2024

CodSpeed Performance Report

Merging #1239 will improve performances by 23.19%

Comparing booqoffsky:patch-1 (0480531) with master (5494503)

Summary

⚡ 1 improvements
✅ 83 untouched benchmarks

Benchmarks breakdown

Benchmark master booqoffsky:patch-1 Change
test_making_and_inserting_models_in_bulk[10] 5 ms 4 ms +23.19%

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.

2 participants