Commit d325bdfc authored by David Haynes's avatar David Haynes
Browse files

Complete comments for

 - fairly straightforward django-admin command
parent b88cdd89
Pipeline #467 passed with stage
in 7 minutes and 16 seconds
# Django Imports
from import BaseCommand
from django.utils import timezone
from go.models import URL
# App Imports
from go.models import URL
# Define a new custom django-admin command
class Command(BaseCommand):
# Define help text for this command
help = 'Removes expired links from the database'
# The handle function handles the main component of the django-admin command
def handle(self, *args, **options):
# Loop through a list of all URL objects that have expired
# (expires field is less than or equal to today's date)
for toexpire in URL.objects.filter(
# Delete the current URL
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment