mick-t / django-tasks

Automatically exported from code.google.com/p/django-tasks
2 stars 0 forks source link

Method not registered #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Django 1.3
Current version of django-task

Example Model

class Group(EC2Model):
    env = models.ForeignKey(Env)
    name = models.CharField(max_length=50)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return "%s for %s" % (self.name, self.env)

    def test(self):
        print "got here"
        return 0

In my view

m = Group()
m.save()

task = djangotasks.task_for_object(m.test)

Exception

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/operations/setup/group/?id=1

Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'config',
 'index',
 'operations',
 'djangotasks']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'middleware.auth.LoginRequiredMiddleware',
 'middleware.setup.SetupRequiredMiddleware')

Traceback:
File 
"/Users/mzupan/django/sp/lib/python2.7/site-packages/django/core/handlers/base.p
y" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/mzupan/django/sp/www/operations/views.py" in config_group
  29.             form.save()
File "/Users/mzupan/django/sp/www/operations/forms.py" in save
  74.         task = djangotasks.task_for_object(m.test)
File "/Users/mzupan/django/sp/www/djangotasks/__init__.py" in task_for_object
  66.     return Task.objects.task_for_object(object_method.im_class, object_method.im_self.pk, object_method.im_func.__name__)
File "/Users/mzupan/django/sp/www/djangotasks/models.py" in task_for_object
  99.             raise Exception("Method '%s' not registered for model '%s'" % (method, model))

Exception Type: Exception at /operations/setup/group/
Exception Value: Method 'test' not registered for model 'operations.group'

Original issue reported on code.google.com by hiji...@gmail.com on 6 Apr 2011 at 3:49

GoogleCodeExporter commented 9 years ago
you can close this.. user mistake.. I didn't register the method correctly

Original comment by hiji...@gmail.com on 6 Apr 2011 at 10:34

GoogleCodeExporter commented 9 years ago
ok, closing

Original comment by farial...@gmail.com on 19 May 2011 at 8:14