Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
hooks:
- id: codespell
args: [-I, .codespell_ignore.txt]
exclude: ^main/static/assets/|^package-lock.json$
exclude: ^main/static/assets/|^package-lock.json$|^direct_webapp/fixtures/framework-2-0.json$
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

necessary for now as there are typos in the framework direct-framework/digital-research-competencies-framework#249

- repo: https://github.com/djlint/djLint
rev: v1.36.4
hooks:
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ This Django project uses:

## Installation

You must have **Python version 3.12 or later** installed.

To get started:

1. Create and activate a [virtual environment](https://docs.python.org/3/library/venv.html):
Expand Down Expand Up @@ -93,10 +95,10 @@ To get started:
python manage.py createsuperuser
```

8. To populate the db with Categories and Skills from a yaml or json version of the framework
8. Populate the database using a snapshot of v2.0 of the framework (this is not necessarily the latest live version, so this is only used for development).

```bash
python -m scripts.populate_db [-j data.json]|[-y data.yaml]
python manage.py loaddata direct_webapp/fixtures/framework-2-0.json
```

### Installation with Docker
Expand Down
25 changes: 25 additions & 0 deletions direct_webapp/fixtures/README.md
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

happy to move this documentation if there's a better place for it

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Fixtures

This folder contains Django [fixtures](https://docs.djangoproject.com/en/6.0/topics/db/fixtures/#fixtures-explanation) - files that contain the serialized contents of the database. These can be used to quickly load data into a freshly initialised database (in development or in production).

## Creating / updating the fixtures

The fixtures were originally created by the following process:

1. manually gather the CSV files from <https://github.com/direct-framework/digital-research-competencies-framework/tree/main/framework>
2. load each CSV into a fresh dev database through the Django admin interface. Ordering is important as some tables reference others:
1. competency domains
1. competencies
1. providers
1. learning resources
1. skill levels
1. tools, languages, and methodologies
1. skills
3. on the command line, "dump" the data to json in fixture format: `python manage.py dumpdata -o direct_webapp/fixtures/data.json main --exclude main.user`
* `-o` sets the output location to `direct_webapp/fixtures/data.json`
* `main` selects the app to export
* `--exclude` selects models to exclude from the export (in this case the user table)

The fixtures can then be loaded in a fresh database with `python manage.py loaddata direct_webapp/fixtures/framework-2-0.json`.

The process can be repeated to update the fixtures. In future a script could be developed to automate updating the fixture when the framework is updated, if we decide to keep them in sync.
Loading
Loading