This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.core.management.base import BaseCommand | |
| from rq.registry import FailedJobRegistry | |
| from django_rq.queues import get_queue | |
| from django_rq.utils import get_jobs | |
| class Command(BaseCommand): | |
| help = 'Delete failed jobs from Django RQ.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.utils import timezone | |
| from django.core.validators import MinValueValidator, MaxValueValidator | |
| class ThreatCategory(models.Model): | |
| name = models.CharField(max_length=255) | |
| abbreviation = models.CharField(max_length=50, blank=True, null=True) | |
| def __str__(self): | |
| return self.name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import glob | |
| def delete_migrations(app_name): | |
| # Get the path to the migrations folder of the app | |
| migrations_path = os.path.join(app_name, 'migrations') | |
| # Check if the migrations folder exists | |
| if os.path.exists(migrations_path): | |
| # Find all migration files (except __init__.py) in the migrations folder |
OlderNewer