Re: custom management commands: AttributeError: 'module' object has no attribute 'Command'

2012-08-13 Thread Kurtis Mullins
I'd look more into the full traceback. I haven't had any trouble with
underscores either.

On Mon, Aug 13, 2012 at 2:31 PM, creecode  wrote:

> I have many custom management command names that have underscores in them.
>  I've never had a problem.  I believe that a management command name only
> needs follow python rules for naming files.
>
>
> On Sunday, August 12, 2012 1:44:06 AM UTC-7, Melvyn Sopacua wrote:
>
> On 11-8-2012 2:14, Matthew Meyer wrote:
>>
>> Since I don't see anything wrong with your code or setup, I'm going to
>> take a stab in the dark and say that you need to loose the underscore in
>> the command.
>>
>
> Toodle-looo
> creedcode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/IyKV_xgNgOcJ.
>
> 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.
>

-- 
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.



Re: custom management commands: AttributeError: 'module' object has no attribute 'Command'

2012-08-13 Thread creecode
I have many custom management command names that have underscores in them. 
 I've never had a problem.  I believe that a management command name only 
needs follow python rules for naming files.

On Sunday, August 12, 2012 1:44:06 AM UTC-7, Melvyn Sopacua wrote:

On 11-8-2012 2:14, Matthew Meyer wrote: 
>
> Since I don't see anything wrong with your code or setup, I'm going to 
> take a stab in the dark and say that you need to loose the underscore in 
> the command.
>

Toodle-looo
creedcode 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IyKV_xgNgOcJ.
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.



Re: custom management commands: AttributeError: 'module' object has no attribute 'Command'

2012-08-12 Thread Melvyn Sopacua
On 11-8-2012 2:14, Matthew Meyer wrote:

> The command I am running is :
> 
> $ python manage.py event_expiration
> 
> I've made sure I am adding the event_expiration.py file within management 
> and commands folders and that those folders have init files. those are in 
> one of my app folders.
> 
> Am I overlooking something here? Any help is appreciated, thanks!

Since I don't see anything wrong with your code or setup, I'm going to
take a stab in the dark and say that you need to loose the underscore in
the command.
Otherwise, please provide the *full* traceback for more clues.

-- 
Melvyn Sopacua

-- 
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.



custom management commands: AttributeError: 'module' object has no attribute 'Command'

2012-08-10 Thread Matthew Meyer
 

I am trying to make a custom management command as show in the docs here: 
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

When I try to run the command from my project directory I am experiencing 
the following error:

AttributeError: 'module' object has no attribute 'Command'

Here is the file:

#event_expiration.py
from django.core.management.base import BaseCommand, CommandError
from app.models import Event
import datetime

class Command(BaseCommand):
help = 'deletes expired events'

def handle(self, *args, **options):

today = datetime.datetime.now()
events = Event.objects.filter(date=datetime.date(2011,11,11))

for e in events:
e.delete()

self.stdout.write('Expired events successfully deleted.')

The command I am running is :

$ python manage.py event_expiration

I've made sure I am adding the event_expiration.py file within management 
and commands folders and that those folders have init files. those are in 
one of my app folders.

Am I overlooking something here? Any help is appreciated, thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hG2tkLMfDO0J.
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.