Skip to content

Instantly share code, notes, and snippets.

View SuperSuperDev's full-sized avatar
🎯
Focusing

Steven Saunders SuperSuperDev

🎯
Focusing
View GitHub Profile

Seeding Data in Django

#django

  • Have Django create a seeds file automatically from the data that already exists in the table python manage.py dumpdata app-name --output app-name/seeds.json --indent=2 - Depending on if you need to change...command could be a one time thing.
  • Empty the database of all rows inside currently. python manage.py flush and answer "yes" when prompted.
  • Load your data from the seeds file, back into the database. python manage.py loaddata app_name/seeds.json
  • Create your superuser again, as you have been deleted too... Show more
# Resetting a Postgres DB w Django
#django
* Drop the database `dropdb db_name`
* Delete migration...except `__init__.py`
* create the db again, `createdb db_name`
* make migration `python manage.py makemigrations`
* migrate `python manage.py migrate`
* If you want to re seed, you can now `python loadata .......`
@SuperSuperDev
SuperSuperDev / settings.json
Last active June 15, 2021 23:48
vscode settings
{
"workbench.colorCustomizations": {
"statusBar.background": "#fe5ede",
"titleBar.activeBackground": "#fe5ede",
"titleBar.inactiveBackground": "#fe5ede99",
"statusBar.foreground": "#15202b",
"titleBar.inactiveForeground": "#15202b99",
"titleBar.activeForeground": "#15202b",
"activityBar.activeBackground": "#fe91e8",
"activityBar.activeBorder": "#657e01",
[MESSAGES CONTROL]
disable=arguments-differ,missing-function-docstring,missing-class-docstring,no-self-use,raise-missing-from,no-member,missing-module-docstring,invalid-name,too-few-public-methods, relative-beyond-top-level
@SuperSuperDev
SuperSuperDev / git-dev-branch
Last active May 21, 2021 17:13
Git Command Dev Branch
```gco -b name-of-branch```
MAKE THE CODE CHANGES YOU NEED FOR YOUR FEATURE!
git add .
git commit -m "my great new feature" (You can add and commit as often as you like at this stage. Recommend at least daily)
gco development (check out your development branch)
git pull origin development (pull the latest from github)
gco name-of-branch (check out your feature branch)
git merge development Merge your development branch into your feature branch.
If there were any conflicts, resolve them, involving your team as needed. Make sure to test your program after doing this!
git add . (Only necessary if there were conflicts)
@SuperSuperDev
SuperSuperDev / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console