Skip to content

Instantly share code, notes, and snippets.

View Afeez1131's full-sized avatar

Lawal Afeez Afeez1131

View GitHub Profile
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.'
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
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