From 75405a4651e3c05a3f82c455e13500deb7bfb895 Mon Sep 17 00:00:00 2001 From: jpic <jamespic@gmail.com> Date: Sun, 27 Dec 2015 13:15:19 +0100 Subject: [PATCH] Added database cleaning commands remove_dossiers_without_recommendation and remove_representatives_without_votes are useful to clean the database before dumping test fixtures. --- representatives_votes/management/__init__.py | 0 representatives_votes/management/commands/__init__.py | 0 .../commands/remove_dossiers_without_proposal.py | 8 ++++++++ .../commands/remove_representatives_without_vote.py | 8 ++++++++ 4 files changed, 16 insertions(+) create mode 100644 representatives_votes/management/__init__.py create mode 100644 representatives_votes/management/commands/__init__.py create mode 100644 representatives_votes/management/commands/remove_dossiers_without_proposal.py create mode 100644 representatives_votes/management/commands/remove_representatives_without_vote.py diff --git a/representatives_votes/management/__init__.py b/representatives_votes/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/representatives_votes/management/commands/__init__.py b/representatives_votes/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/representatives_votes/management/commands/remove_dossiers_without_proposal.py b/representatives_votes/management/commands/remove_dossiers_without_proposal.py new file mode 100644 index 0000000..302eaea --- /dev/null +++ b/representatives_votes/management/commands/remove_dossiers_without_proposal.py @@ -0,0 +1,8 @@ +from representatives.management.remove_command import RemoveCommand + +from representatives_votes.models import Dossier + + +class Command(RemoveCommand): + manager = Dossier.objects + conditions = {'proposals': None} diff --git a/representatives_votes/management/commands/remove_representatives_without_vote.py b/representatives_votes/management/commands/remove_representatives_without_vote.py new file mode 100644 index 0000000..1d942e5 --- /dev/null +++ b/representatives_votes/management/commands/remove_representatives_without_vote.py @@ -0,0 +1,8 @@ +from representatives.management.remove_command import RemoveCommand + +from representatives.models import Representative + + +class Command(RemoveCommand): + manager = Representative.objects + conditions = {'votes': None} -- GitLab