Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. from optparse import make_option
  2. import os.path
  3.  
  4.  
  5. from django.core.management.base import AppCommand
  6. from django.core.management.base import NoArgsCommand
  7. from django.core.management.color import no_style
  8. from django.core.management.commands import sqlclear, syncdb
  9. from django.core.management.commands import dumpdata
  10. from django.db import connections, DEFAULT_DB_ALIAS
  11. from treemenus.models import Menu, MenuItem
  12. from zojax.django.extendedmenus.models import MenuItemExtension
  13. import project
  14.  
  15. class Command(NoArgsCommand):
  16.     help = "Save needed data to fixtures."
  17.  
  18.     def handle_noargs(self, **options):
  19.         from django.db import connection, transaction
  20.         command = dumpdata.Command()
  21.         command.style = no_style()
  22.         print "Dumping project data..."
  23.         res = command.handle('treemenus', 'extendedmenus', 'pages', 'flatblocks', 'extendedflatblocks', 'authentication.ChallengeQuestion')
  24.         open(os.path.join(project.__path__[0], 'fixtures','data.yaml'),'w+').write(res)
  25.         print 'Done!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement