-
Notifications
You must be signed in to change notification settings - Fork 15
Add fixture to populate database with framework v2.0 #713
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
Merged
AdrianDAlessandro
merged 2 commits into
direct-framework:cw26-hack-day
from
elichad:add-fixtures
Apr 30, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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
| 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. |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
necessary for now as there are typos in the framework direct-framework/digital-research-competencies-framework#249