Assuming that you want to retrieve an integer value by passing the primary key of an object in Django, you can achieve this by following these steps:
from your_app.models import YourModel
@task
def my_task(pk):
obj = YourModel.objects.get(pk=pk)
value = obj.int_field_name
print(value)
return value
You can call this celery task passing the primary key of your object as an argument and you will retrieve the integer value at the end of the task.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-06-30 11:00:00 +0000
Seen: 11 times
Last updated: Sep 10 '21
What does it mean when the JSON is marked as invalid due to it being undefined?
How can you boost the velocity of an object on phaser2 without altering its orientation?
How can an object be transferred from an injected page script to a content script?
How can a new object with a specific type be created in Angular 2 using the domain model?
Why isn't the user interface updating when adding a custom object with data binding in .NET MAUI?
How to serialize an object within an arrayList that is modified during program execution?
In the disposable object, where are the IDispose and IDisposeAsync methods not present?
How to retrieve data from a nested jsonb object in Supabase?