2👍
✅
You should use DateField
instead of DateTimeField
, and if you need to create something more complex (like one new field per hour), you should try to create your own field or use filters.
If you want to use filters, just do something like this:
get_or_create(Model, date__year=datetime.now().year, [...])
You can also create a cron task that create a field each day.
These articles can ask to your question:
- http://docs.djangoproject.com/en/1.2/ref/models/fields/#datefield
- docs.djangoproject.com/en/1.2/howto/custom-model-fields/
- docs.djangoproject.com/en/1.2/topics/db/queries/#retrieving-specific-objects-with-filters
Source:stackexchange.com