Model field displaying some zip codes as 4 characters only, ex: 1234
I want to change all zip codes with 4 characters to 5 by adding a "0" at the start, ex: 01234
Trying to find a way to do this from shell because I have a few thousand objects
from app.models import Entry
I tried:
Entry.objects.filter(len(zip_code)==4).update("0"+zip_code)
and
Entry.objects.filter(len(zip_code)==4).update(f("0"+{zip_code}))
Error returned:
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'zip_code' is not defined