Mar-19-2024, 04:11 AM
Hi all
For loop is not working in my CMD when do operations on DB tables in Django
import random
>>> import random
>>>
>>> for vege in veges:
... vege.recipe_view_count = random.randint(10, 100)
... vege.save()
...
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'veges' is not defined
>>> recipes = Recipe.objects.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'Recipe' is not defined
>>>
I getting this error.
For loop is not working in my CMD when do operations on DB tables in Django
import random
>>> import random
>>>
>>> for vege in veges:
... vege.recipe_view_count = random.randint(10, 100)
... vege.save()
...
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'veges' is not defined
>>> recipes = Recipe.objects.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'Recipe' is not defined
>>>
I getting this error.