mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-28 19:52:14 +00:00
Add data JSONField to LibraryVersion model Add fields to library list admin display Add commands to update authors and maintainers individually Exclude data JSONField from view querysets Silence some output from the library-version import management command Remove unused field from the library-version import management command Save library-versions more cleanly in the library-version import management command Remove loading maintainers from the import command, since they now have their own command Add docs for new commands Add boost_setup command to run one command to import all data Add docs on first-time data import Better exception handling, quieter flow, reduce GH API calls Graceful handling if there is not a github repo Pass most recent 12 months to commit counts command Add some user-friendly output to setup command
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import djclick as click
|
|
|
|
from libraries.models import Library
|
|
from libraries.github import LibraryUpdater
|
|
|
|
|
|
@click.command()
|
|
@click.option("--library-name", is_flag=False, help="Library name (case-insensitive)")
|
|
def command(library_name):
|
|
"""Cycles through all Libraries in the database, and for each, uses the data
|
|
in its `data` field to load the authors of that Library.
|
|
|
|
Depends on the `data` field in the Library model containing an `authors` field. This
|
|
data comes from the libraries.json file in the GitHub repo for the library at the
|
|
`master` branch.
|
|
|
|
If `--library-name` is specified, then only authors for that library will be loaded.
|
|
"""
|
|
click.secho("Adding library authors...", fg="green")
|
|
updater = LibraryUpdater()
|
|
libraries = Library.objects.all()
|
|
if library_name is not None:
|
|
libraries = libraries.filter(library__name__iexact=library_name)
|
|
|
|
for library in libraries.order_by("name"):
|
|
if not library.data:
|
|
continue
|
|
|
|
updater.update_authors(library, authors=library.data.get("authors", []))
|
|
|
|
click.secho("Finished adding library authors.", fg="green")
|