Force settings.DEBUG = False in timeline manage commands
parent
4df5224259
commit
77f9d34be6
|
@ -15,18 +15,16 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from taiga.timeline.models import Timeline
|
||||
from taiga.projects.models import Project
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Regenerate unnecessary new memberships entry lines'
|
||||
def handle(self, *args, **options):
|
||||
debug_enabled = settings.DEBUG
|
||||
if debug_enabled:
|
||||
print("Please, execute this script only with DEBUG mode disabled (DEBUG=False)")
|
||||
return
|
||||
|
||||
@override_settings(DEBUG=False)
|
||||
def handle(self, *args, **options):
|
||||
removing_timeline_ids = []
|
||||
for t in Timeline.objects.filter(event_type="projects.membership.create").order_by("created"):
|
||||
print(t.created)
|
||||
|
|
|
@ -25,6 +25,8 @@ from django.core.exceptions import ObjectDoesNotExist
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Model
|
||||
from django.db import reset_queries
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
||||
from taiga.projects.models import Project
|
||||
from taiga.projects.history import services as history_services
|
||||
|
@ -165,13 +167,8 @@ class Command(BaseCommand):
|
|||
help='Selected project id for timeline generation'),
|
||||
)
|
||||
|
||||
|
||||
@override_settings(DEBUG=False)
|
||||
def handle(self, *args, **options):
|
||||
debug_enabled = settings.DEBUG
|
||||
if debug_enabled:
|
||||
print("Please, execute this script only with DEBUG mode disabled (DEBUG=False)")
|
||||
return
|
||||
|
||||
if options["purge"] == True:
|
||||
Timeline.objects.all().delete()
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Model
|
||||
from django.db import reset_queries
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from taiga.timeline.service import (_get_impl_key_from_model,
|
||||
_timeline_impl_map, extract_user_info)
|
||||
|
@ -88,10 +89,6 @@ def generate_timeline():
|
|||
class Command(BaseCommand):
|
||||
help = 'Regenerate project timeline'
|
||||
|
||||
@override_settings(DEBUG=False)
|
||||
def handle(self, *args, **options):
|
||||
debug_enabled = settings.DEBUG
|
||||
if debug_enabled:
|
||||
print("Please, execute this script only with DEBUG mode disabled (DEBUG=False)")
|
||||
return
|
||||
|
||||
generate_timeline()
|
||||
|
|
|
@ -18,6 +18,7 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Prefetch, F
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from taiga.timeline.models import Timeline
|
||||
from taiga.timeline.timeline_implementations import userstory_timeline
|
||||
|
@ -34,7 +35,7 @@ def update_timeline(initial_date, final_date):
|
|||
timelines = timelines.filter(created__lt=final_date)
|
||||
|
||||
timelines = timelines.filter(event_type="tasks.task.change")
|
||||
|
||||
|
||||
print("Generating tasks indexed by id dict")
|
||||
task_ids = timelines.values_list("object_id", flat=True)
|
||||
tasks_per_id = {task.id: task for task in Task.objects.filter(id__in=task_ids).select_related("user_story").iterator()}
|
||||
|
@ -77,10 +78,6 @@ class Command(BaseCommand):
|
|||
help='Final date for timeline update'),
|
||||
)
|
||||
|
||||
@override_settings(DEBUG=False)
|
||||
def handle(self, *args, **options):
|
||||
debug_enabled = settings.DEBUG
|
||||
if debug_enabled:
|
||||
print("Please, execute this script only with DEBUG mode disabled (DEBUG=False)")
|
||||
return
|
||||
|
||||
update_timeline(options["initial_date"], options["final_date"])
|
||||
|
|
Loading…
Reference in New Issue