Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2796 closed enhancement (wontfix)

daily_cleanup outdated and hard to access

Reported by: sdistefano Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


So I made a patch (first time I'm touching the code, so probably not good enough). It adds a cleanup option to, which seems more logical to me

here it goes

--- (révision 3797)
+++ (copie de travail)
@@ -1187,6 +1187,20 @@

test.help_doc = 'Runs the test suite for the specified applications, or the entire site if no apps are specified'
test.args = '[--verbosity] ' + APP_ARGS

+def cleanup():
+ "Runs the daily cleanup job for this site"
+ from django.conf import settings
+ from django.db import backend, connection, transaction
+ # Clean up old database records
+ cursor = connection.cursor()
+ cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
+ (backend.quote_name('django_session'), backend.quote_name('expire_date')))
+ transaction.commit_unless_managed()
+cleanup.help_doc = 'Runs the daily cleanup job for this site'
+cleanup.args = ""

# Utilities for command-line script


@@ -1212,6 +1226,7 @@

'syncdb': syncdb,
'validate': validate,

+ 'cleanup':cleanup,



@@ -1223,6 +1238,7 @@


+ 'cleanup',


class DjangoOptionParser(OptionParser):

@@ -1296,7 +1312,7 @@

if action == 'shell':

action_mapping[action](options.plain is True)

  • elif action in ('validate', 'diffsettings', 'dbshell'):

+ elif action in ('validate', 'diffsettings', 'dbshell', 'cleanup'):


elif action == 'syncdb':

action_mapping[action](int(options.verbosity), options.interactive)

Change History (2)

comment:1 Changed 12 years ago by anonymous

Resolution: wontfix
Status: newclosed

Firstly, you don't explain what the problem is that you're trying to fix. Why is daily_cleanup outdated? Secondly, this sort of thing doesn't belong in And finally, in the future (and I hope you will continue to offer up improvements in the future), please attach patches as attachments (create the ticket first, then edit it and attach the file). It is not easy to work with code fragments pasted in the body as you have done.

comment:2 Changed 12 years ago by Malcolm Tredinnick

Sorry. That resolution was made by me.

Note: See TracTickets for help on using tickets.
Back to Top