-
Notifications
You must be signed in to change notification settings - Fork 7
Adiciona filtros na area admin dos procs #756
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
Adiciona filtros na area admin dos procs #756
Conversation
- Substitui ModelAdmin por SnippetViewSet para modernizar interface - Adapta ArticleModelAdmin, RelatedItemModelAdmin e RequestArticleChangeModelAdmin - Converte ModelAdminGroup para SnippetViewSetGroup - Comenta temporariamente helpers customizados que precisam adaptação - Adiciona filtro por journal na listagem de artigos
- Converte IssueAdmin e TOCAdmin de ModelAdmin para SnippetViewSet - Adiciona configurações de paginação, ordenação e exportação - Implementa UpdatedAtColumn para melhor visualização de timestamps - Configura list_export para CSV e XLSX - Define ordenação padrão por ano de publicação e atualização
- Converte OfficialJournalAdmin e JournalAdmin para ViewSets - Implementa panels customizados para formulários de edição - Adapta método save_all através de get_form_class customizado - Configura JournalViewSetGroup para organização no menu - Mantém lógica de associação de usuário na criação/edição
- Converte todos ModelAdmin de migração para SnippetViewSet - Remove MigrationFailureAdmin comentado - Implementa ClassicWebsiteConfigurationViewSet com filtros melhorados - Atualiza MigratedData, MigratedArticle, MigratedJournal e MigratedIssue - Adiciona MigratedFileViewSet e IdFileRecordViewSet - Cria MigrationViewSetGroup para organização hierárquica
- Converte JournalProc, IssueProc, HTMLXML para SnippetViewSet - Atualiza SPSPkg e ArticleProc com novas configurações de listagem - Implementa ProcReportViewSet para relatórios de processamento - Mantém views customizadas ProcCreateView e ProcEditView - Cria ProcessViewSetGroup organizando todos os snippets - Remove configurações deprecated de ModelAdmin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates Wagtail admin interfaces from the deprecated wagtail_modeladmin package to the modern SnippetViewSet and SnippetViewSetGroup classes. The main purpose is to add collection filters to processing modules while modernizing the admin interface approach.
- Replaces ModelAdmin classes with SnippetViewSet classes across multiple modules
- Adds collection filtering capability to processing admin interfaces
- Updates import statements and registration methods throughout the codebase
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| proc/wagtail_hooks.py | Migrates processing admin from ModelAdmin to SnippetViewSet, adds collection filters |
| migration/wagtail_hooks.py | Converts migration admin interfaces to SnippetViewSet, improves filtering options |
| journal/wagtail_hooks.py | Updates journal admin with SnippetViewSet and enhanced form handling |
| issue/wagtail_hooks.py | Modernizes issue admin interface with SnippetViewSet pattern |
| article/wagtail_hooks.py | Partially migrates article admin to SnippetViewSet with commented adaptations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| edit_view_class = ProcEditView | ||
| list_per_page = 10 | ||
| list_display = ( | ||
|
|
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary blank line to maintain consistent spacing.
| MigratedIssueViewSet, | ||
| MigratedArticleViewSet, | ||
| MigratedFileViewSet, | ||
| IdFileRecordViewSet, |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace after the comma.
| IdFileRecordViewSet, | |
| IdFileRecordViewSet, |
| @@ -1,86 +1,128 @@ | |||
| # wagtail_hooks.py (ou views.py) | |||
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment indicating alternative file name - it's unclear and unnecessary in the actual file.
| # wagtail_hooks.py (ou views.py) |
| instance.created_by = self.request.user | ||
| instance.updated_by = self.request.user |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The form instance doesn't have access to self.request. Use the request parameter passed to the method instead of self.request.
| button_helper_class = ArticleButtonHelper | ||
| permission_helper_class = ArticlePermissionHelper | ||
| inspect_view_enabled = True | ||
| menu_label = _("Articles") |
Copilot
AI
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The menu label has changed from 'Tasks' to 'Articles'. Ensure this change is intentional and consistent with the application's navigation structure.
O que esse PR faz?
Migra os módulos de Article, Issue e Journal de ModelAdmin (wagtail-modeladmin) para SnippetViewSet, seguindo as práticas modernas do Wagtail. Esta mudança é parte do esforço de modernização da plataforma, já que ModelAdmin está sendo descontinuado em favor do SnippetViewSet nativo do Wagtail.
As principais mudanças incluem:
Onde a revisão poderia começar?
Sugiro iniciar pela migração mais simples para entender o padrão:
journal/wagtail_hooks.py- migração básica de JournalAdmin para JournalViewSetissue/wagtail_hooks.py- migração com mais configurações (IssueSnippetViewSet e TOCSnippetViewSet)article/wagtail_hooks.py- migração mais complexa com views customizadasComo este poderia ser testado manualmente?
/admin/)Algum cenário de contexto que queira dar?
O wagtail-modeladmin está sendo descontinuado e a recomendação oficial é migrar para SnippetViewSet. Esta migração traz benefícios como:
Nota importante: Algumas funcionalidades customizadas (ButtonHelper, PermissionHelper) precisarão de adaptação adicional em PRs subsequentes. Os comentários no código indicam onde essas adaptações serão necessárias.
Screenshots
[Adicionar screenshots mostrando:]
Quais são tickets relevantes?
#743 - Migração de ModelAdmin para SnippetViewSet
Referências