Opened 10 years ago

Last modified 3 years ago

#22640 closed Cleanup/optimization

Can create model instance with conflicting args and kwargs value for the same field — at Initial Version

Reported by: Peter Zsoldos Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Discovered while working on #18586

To reproduce it, add the following test (it's using tests.basic.models.Article)

    def test_cannot_specify_same_field_with_args_and_kwargs_too(self):
        six.assertRaisesRegex(
            self,
            TypeError,
            "'foo' is an invalid keyword argument for this function",
            Article,
            None, # id
            'args based headline',
            headline='kwargs based headline',
            pub_date=datetime(2005, 7, 31),
        )

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top