28 lines
819 B
Python
28 lines
819 B
Python
|
from django.core.management.base import BaseCommand
|
||
|
|
||
|
from drupal2spip_lal.base.convert import convert_node
|
||
|
from drupal2spip_lal.drupal.models import Node
|
||
|
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
help = "Import Drupal nodes to SPIP articles."
|
||
|
|
||
|
def add_arguments(self, parser):
|
||
|
parser.add_argument(
|
||
|
'--node',
|
||
|
nargs='*',
|
||
|
type=int,
|
||
|
help='Selects what nodes should be imported. Default is none.',
|
||
|
)
|
||
|
parser.add_argument(
|
||
|
'--update',
|
||
|
action='store_true',
|
||
|
help='Force existing articles to be updated. Default is skip.',
|
||
|
)
|
||
|
|
||
|
def handle(self, **options):
|
||
|
[
|
||
|
convert_node(n, update=options.get('update', False))
|
||
|
for n in Node.objects.filter(pk__in=options.get('node', []))
|
||
|
]
|