
import os, datetime

def clean_up():
	# Set Django settings module.
	os.environ.setdefault("DJANGO_SETTINGS_MODULE", "StackSmash.settings")

	# import our blog stuff
	from StackSmash.apps.blog.models import Comment, Post
	
	# if comments are not listed and older than a week, delete them.
	Comment.objects.filter(listed=False, created__lt = datetime.datetime.now() - datetime.timedelta(days=7)).delete()

#       comments = Comment.objects.filter(listed=False).order_by("created")

       # If comments are older than a day, delete them.
#       for comment in comments:
#               if comment.created.day < datetime.datetime.now().day:
#                       Comment.objects.filter(listed=False, id=comment.id).delete()


if __name__ == "__main__":
       clean_up()


import os, datetime

def clean_up():
	# Set Django settings module.
	os.environ.setdefault("DJANGO_SETTINGS_MODULE", "StackSmash.settings")

	# import our blog stuff
	from StackSmash.apps.blog.models import Comment, Post
	
	# if comments are not listed and older than a week, delete them.
	Comment.objects.filter(listed=False, created__lt = datetime.datetime.now() - datetime.timedelta(days=7)).delete()

if __name__ == "__main__":
       clean_up()

Add cron information, clean up old cruft that isnt needed.
Add cron information, clean up old cruft that isnt needed.

  
  import os, datetime
  
  def clean_up():
  	# Set Django settings module.
  	os.environ.setdefault("DJANGO_SETTINGS_MODULE", "StackSmash.settings")
  
  	# import our blog stuff
  	from StackSmash.apps.blog.models import Comment, Post
  	
  	# if comments are not listed and older than a week, delete them.
  	Comment.objects.filter(listed=False, created__lt = datetime.datetime.now() - datetime.timedelta(days=7)).delete()
  
- #       comments = Comment.objects.filter(listed=False).order_by("created")
- 
-        # If comments are older than a day, delete them.
- #       for comment in comments:
- #               if comment.created.day < datetime.datetime.now().day:
- #                       Comment.objects.filter(listed=False, id=comment.id).delete()
- 
- 
  if __name__ == "__main__":
         clean_up()
  
Add cron information, clean up old cruft that isnt needed.
## Code Before:

import os, datetime

def clean_up():
	# Set Django settings module.
	os.environ.setdefault("DJANGO_SETTINGS_MODULE", "StackSmash.settings")

	# import our blog stuff
	from StackSmash.apps.blog.models import Comment, Post
	
	# if comments are not listed and older than a week, delete them.
	Comment.objects.filter(listed=False, created__lt = datetime.datetime.now() - datetime.timedelta(days=7)).delete()

#       comments = Comment.objects.filter(listed=False).order_by("created")

       # If comments are older than a day, delete them.
#       for comment in comments:
#               if comment.created.day < datetime.datetime.now().day:
#                       Comment.objects.filter(listed=False, id=comment.id).delete()


if __name__ == "__main__":
       clean_up()

## Instruction:
Add cron information, clean up old cruft that isnt needed.
## Code After:

import os, datetime

def clean_up():
	# Set Django settings module.
	os.environ.setdefault("DJANGO_SETTINGS_MODULE", "StackSmash.settings")

	# import our blog stuff
	from StackSmash.apps.blog.models import Comment, Post
	
	# if comments are not listed and older than a week, delete them.
	Comment.objects.filter(listed=False, created__lt = datetime.datetime.now() - datetime.timedelta(days=7)).delete()

if __name__ == "__main__":
       clean_up()
