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

Add management commands to export/import mega menu #6011

Merged
merged 2 commits into from
Sep 16, 2020

Commits on Sep 15, 2020

  1. Add management commands to export/import mega menu

    This commit adds two new management commands for exporting and importing
    mega menu content to and from JSON. These commands will enable easier
    and more repeatable updating of menu content.
    
    To export:
    
    cfgov/manage.py export_mega_menu language output.json
    OR
    cfgov/manage.py export_mega_menu language (writes to stdout)
    
    For example:
    
    cfgov/manage.py export_mega_menu en current.json
    
    To import:
    
    cfgov/manage.py import_mega_menu language input.json
    OR
    cfgov/manage.py import_mega_menu language (reads from stdin)
    
    For example:
    
    cat new.json | cfgov/manage.py import_mega_menu en
    
    The JSON format used is the content of the existing Menu object's
    submenus StreamField. For testing purposes, I've created two JSON files
    that can be used to switch back and forth between the current site mega
    menu and an alternate one. Assuming that you have github.local aliased
    to our internal GHE server, you can run these commands to toggle back
    and forth.
    
    Current menu:
    
    curl -k https://github.local/raw/gist/chosak/4600af0d52fbe588a634ea6fee54f942/raw/5af1c1428f63ddfd7f6fc8ba9fa115b0ac17235a/current.json | cfgov/manage.py import_mega_menu en
    
    New menu:
    
    curl -k https://github.local/raw/gist/chosak/fdeab64f382ca0d17568cdbd717862d8/raw/9b2e8fb73062ec631c609d69c1e9ee49261b6459/new.json | cfgov/manage.py import_mega_menu en
    chosak committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    af9ce77 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2020

  1. Configuration menu
    Copy the full SHA
    5644ff1 View commit details
    Browse the repository at this point in the history