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

5.0: Update django.contrib.admin.views and django.forms.forms.Form metaclass #2079

Merged
merged 3 commits into from
Apr 30, 2024
Merged

5.0: Update django.contrib.admin.views and django.forms.forms.Form metaclass #2079

merged 3 commits into from
Apr 30, 2024

Conversation

sudosubin
Copy link
Contributor

I have made things!

Update stubs for django.contrib.admin.views.main for Django 5.0.

  • django.contrib.admin.views.main
    • django.contrib.admin.views.main.ChangeList.add_facets was added
    • django.contrib.admin.views.main.ChangeList.is_facets_optional was added
    • django.contrib.admin.views.main.ChangeList.filter_params was added
    • django.contrib.admin.views.main.ChangeList.remove_facet_link was added
    • django.contrib.admin.views.main.ChangeList.add_facet_link was added

Missing type stubs were added.

  • django.contrib.admin.views.main
    • django.contrib.admin.views.main.ChangeListSearchForm
    • django.contrib.admin.views.main.ChangeList.search_form_class

Related issues

Refs #1493

@sudosubin sudosubin mentioned this pull request Apr 21, 2024
39 tasks
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Please, double check why stubtest change is not required.

@sudosubin
Copy link
Contributor Author

Please, double check why stubtest change is not required.

Yes, there were some stub error occurred like other cases (ex. django.contrib.auth.forms.*), so I didn't update the allowlist.

error: django.contrib.admin.views.main.ChangeList.search_form_class variable differs from runtime type django.forms.forms.DeclarativeFieldsMetaclass
Stub: in file /app/django-stubs/contrib/admin/views/main.pyi:24
Type[django.forms.forms.Form]
Runtime: in file /usr/local/lib/python3.12/site-packages/django/contrib/admin/views/main.py:58
def (*args, **kwargs)

error: django.contrib.admin.views.main.ChangeListSearchForm is inconsistent, metaclass differs
Stub: in file /app/django-stubs/contrib/admin/views/main.pyi:21
N/A
Runtime: in file /usr/local/lib/python3.12/site-packages/django/contrib/admin/views/main.py:58
<class 'django.forms.forms.DeclarativeFieldsMetaclass'>

@sobolevn
Copy link
Member

Let's update it :)

@sudosubin
Copy link
Contributor Author

I updated django.forms.forms.Form's metaclass, and removed unused allowlist :)

Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Thanks! One observation, let's avoid Any where possible.

django-stubs/contrib/admin/views/main.pyi Outdated Show resolved Hide resolved
@intgr intgr self-assigned this Apr 27, 2024
Copy link
Collaborator

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Oops, this missed the 5.0.0 release, sorry!

@intgr intgr changed the title 5.0: Update django.contrib.admin.views.main 5.0: Update django.contrib.admin.views and django.forms.forms.Form metaclass Apr 30, 2024
@intgr intgr merged commit 9db28a6 into typeddjango:master Apr 30, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants