7👍
Are you using the word “date” as a variable anywhere else in your function or script?.
This happened to me and the fix was to rename any variable named “date” and only use that keyword for the date object.
- [Django]-How to use jqGrid in django frame work
- [Django]-Unable to use curl to get a token with Django OAuth Toolkit
- [Django]-Save memory in Python. How to iterate over the lines and save them efficiently with a 2million line file?
- [Django]-How to add if statement in filter?
0👍
Are you using the word "date" as a variable anywhere else in your function or script? The problem is caused because you have used the date variable in your code. Sometimes it is not possible to change or rename all the variables if we used them more than 500 times. It will change the functionality of a program.
So the solution is, instead of importing the module as, from datetime import date
, you can use an alias name like this: from datetime import date as date_function
then from this:
today = date.today()
change to this:
today = date_function.today()
Hope this is helpful for you!
- [Django]-Django-CMS AppHooks with conflicting urls?
- [Django]-Django : extract a path from a full URL
Source:stackexchange.com