Draft
Conversation
Create a Django management command that removes Article data and its related models (SourceArticle, Contributor, Affiliation, Journal, Program, License, Concepts). For ThematicArea objects, checks if they are referenced by directory models before deleting. For License objects, checks if they are referenced by ScholarlyArticles before deleting. Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Pre-collect ScholarlyArticles license IDs and directory model ThematicArea IDs upfront to avoid per-object queries in loops. Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add command to remove Article data and related models
Add delete_article_data management command
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que esse PR faz?
Adiciona o comando
delete_article_dataque remove todos os dados deArticlee seus modelos relacionados (SourceArticle,Contributor,Affiliation,Journal,Program,License,Concepts).EducationDirectory,InfrastructureDirectory,EventDirectory,PolicyDirectory)ScholarlyArticlesOnde a revisão poderia começar?
article/management/commands/delete_article_data.pyComo este poderia ser testado manualmente?
python manage.py delete_article_dataarticleforam removidosTestes automatizados:
pytest article/tests_delete_article_data.py(12 testes)Algum cenário de contexto que queira dar?
Os IDs de referência em diretórios e ScholarlyArticles são coletados via queries batch antes da iteração, evitando N+1 queries.
Screenshots
N/A — comando CLI sem interface gráfica.
Quais são tickets relevantes?
Referências
harvest/management/commands/education_directory,infrastructure_directory,event_directory,policy_directoryWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
opensearch/usr/bin/python python -m pytest article/tests_delete_article_data.py -v --no-header(dns block)/usr/bin/python python -m pytest article/tests_delete_article_data.py -v --no-header --global cal/bin/bash credential.usernbash(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.