-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from CentreForDigitalHumanities/feature/refres…
…h-db Add options to start with fresh database
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.core.management.base import BaseCommand, CommandParser | ||
|
||
from sync.populate import populate | ||
from lidia.models import delete_all | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Parse raw sync content and populate LIDIA models" | ||
|
||
def add_arguments(self, parser: CommandParser) -> None: | ||
parser.add_argument( | ||
"--refresh", | ||
action="store_true", | ||
help="First remove annotations from database to solve any sync problems" | ||
) | ||
|
||
def handle(self, *args, **options): | ||
if options["refresh"]: | ||
delete_all() | ||
populate() |
This file contains 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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.core.management.base import BaseCommand, CommandParser | ||
|
||
from sync.zoterosync import sync | ||
from sync.models import delete_all | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Synchronize with data on the Zotero server" | ||
|
||
def add_arguments(self, parser: CommandParser) -> None: | ||
parser.add_argument( | ||
"--refresh", | ||
action="store_true", | ||
help="First remove sync information from database to solve any sync problems" | ||
) | ||
|
||
def handle(self, *args, **options): | ||
if options["refresh"]: | ||
delete_all() | ||
sync() |
This file contains 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