[geany/www.geany.org] aab231: Add 'dump_database' management command

Enrico Tröger git-noreply at xxxxx
Wed Oct 28 22:53:57 UTC 2015


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Wed, 28 Oct 2015 22:53:57 UTC
Commit:      aab231c0c77d0612d9fe7752b26ba985e044bf80
             https://github.com/geany/www.geany.org/commit/aab231c0c77d0612d9fe7752b26ba985e044bf80

Log Message:
-----------
Add 'dump_database' management command


Modified Paths:
--------------
    geany/management/commands/dump_database.py

Modified: geany/management/commands/dump_database.py
31 lines changed, 31 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# LICENCE: This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from django.core.management import BaseCommand, call_command
+
+
+########################################################################
+class Command(BaseCommand):
+    help = "Dump the database (excluding users, sessions and logs)"
+
+    #----------------------------------------------------------------------
+    def handle(self, *args, **options):
+        call_command(
+            'dumpdata',
+            '--exclude', 'auth.user',
+            '--exclude', 'sessions.session',
+            '--exclude', 'admin.logentry',
+            '--exclude', 'pastebin.snippet',
+            '--indent', '2',
+            '--output', 'database.json')



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list