How do I retrieve a model instance from the database without a model
instance?

For example from the doc[1] it has:
  product = Product.objects.get(name='Venezuelan Beaver Cheese')

I want something like getInstance( 'Product',  'Venezuelan Beaver
Cheese' )

Here are the details of what I'm doing.  I have multiple form models
that are all handled by the same post processing class.  I'm using
django-celery to do the processing.

I want to do something like this in my view:
  dbSave = form.save()
  processTask.delay('Product', dbSave.pk)

Then in the task:
 class processTask(Task):
    def run(self, modelName, pk):
        instance =  getInstance( modelName, pk )
        ….

>From what I've read about django-celery, I shouldn't pass class
instances to the task so I need a way to pass/retrieve this info via
basic datatypes.

Brian


[1] 
https://docs.djangoproject.com/en/dev/ref/models/instances/#updating-attributes-based-on-existing-fields

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

Reply via email to