Ticket #2557: django-admin-syncmedia.diff

File django-admin-syncmedia.diff, 1.4 KB (added by dummy@…, 18 years ago)
  • django/core/management.py

     
    423423get_sql_all.help_doc = "Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s)."
    424424get_sql_all.args = APP_ARGS
    425425
     426def syncmedia():
     427    "Sync all media files from INSTALLED_APPS into MEDIA_ROOT"
     428    from django.conf import settings
     429    from django.contrib.media import sync_media_root
     430
     431    if settings.MEDIA_ROOT:
     432        sync_media_root()
     433
     434syncmedia.args = ''
     435
    426436def syncdb():
    427437    "Creates the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
    428438    from django.db import connection, transaction, models, get_creation_module
     
    11771187    'startapp': startapp,
    11781188    'startproject': startproject,
    11791189    'syncdb': syncdb,
     1190    'syncmedia': syncmedia,
    11801191    'validate': validate,
    11811192}
    11821193
     
    11891200    'reset',
    11901201    'sqlindexes',
    11911202    'syncdb',
     1203    'syncmedia',
    11921204)
    11931205
    11941206class DjangoOptionParser(OptionParser):
     
    12561268
    12571269    if action == 'shell':
    12581270        action_mapping[action](options.plain is True)
    1259     elif action in ('syncdb', 'validate', 'diffsettings', 'dbshell'):
     1271    elif action in ('syncdb', 'syncmedia', 'validate', 'diffsettings', 'dbshell'):
    12601272        action_mapping[action]()
    12611273    elif action == 'inspectdb':
    12621274        try:
Back to Top