Browse Source

Adds note about importing the task decorator to the userguide. Closes #659

Ask Solem 13 years ago
parent
commit
9e93992a39
2 changed files with 15 additions and 0 deletions
  1. 1 0
      docs/getting-started/first-steps-with-celery.rst
  2. 14 0
      docs/userguide/tasks.rst

+ 1 - 0
docs/getting-started/first-steps-with-celery.rst

@@ -1,4 +1,5 @@
 .. _tut-celery:
+.. _first-steps:
 
 ========================
  First steps with Celery

+ 14 - 0
docs/userguide/tasks.rst

@@ -33,6 +33,20 @@ Task options can be specified as arguments to the decorator:
     def create_user(username, password):
         User.objects.create(username=username, password=password)
 
+.. admonition:: How do I import the task decorator?
+
+The task decorator is available on your Celery instance,
+if you don't know what that is then please read :ref:`first-steps`.
+
+If you're using Django or are still using the "old" module based celery API,
+then you can import the task decorator like this::
+
+    from celery import task
+
+    @task
+    def add(x, y):
+        return x + y
+
 .. _task-request-info:
 
 Context