On Feb 22, 1:00 pm, "phyl.jack...@gmail.com" <phyl.jack...@gmail.com> wrote: > I have a little custom script that changes some database stuff and > sends an email - I want to set it to run on a cron job. > > So Ive been trying to set it up as a custom django-admin command, Ive > been trying to use this little bit of info- > > http://docs.djangoproject.com/en/dev/howto/custom-management-commands... > > I cannot get it tor work. Ive made the dir struture it suggests and it > is finding my python file, Im just not sure how to structure it. I > have this in an update.py file- > > from django.core.management.base import BaseCommand > import os > import sys > > class Command(BaseCommand): > #--my script-- > > The error I get is a NotImplementedError. I know it is reading the > stuff in place of #--my script-- because it was giving me specific > errors related to my script until I fixed them all. I try just putting > something simple in place of #--my script-- like x=1 and it still > gives me that NotImplementedError. Am I doing this right? What should > my update.py file look like? > > Thanks for any help! > Phil
You've cunningly cut out from the code you posted the actual contents of the Command class, which is the bit that would enable us to diagnose the problem. But at a guess, you have just put the script directly under the class. It actually needs to go into a method called 'handle', which is what is called when the command is run. Without that method, Django is calling the method in the base class, which raises NotImplementedError to tell you you need to override it. class Command(BaseCommand): help = """Removes doubled up HTML classes caused by a TinyMCE problem""" def handle(self, *args, **options): ... script goes here... -- DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---