Hi Bobby,
I'm not sure what you mean by "fields don't allow built-in defaults". While
it's true that Django's DateField (for example) doesn't have a built-in
default, here's[1] a custom field with a built-in default:
class MyDateField(models.DateField):
EPOCH = date(197
> On Jun 15, 2015, at 1:42 PM, Rick van Hattem (wolph)
> wrote:
>
> While I understand the rationale, it's not really possible due to the
> underlying Python object:
> >>> import datetime
> >>> datetime.date()
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: Required
While I understand the rationale, it's not really possible due to the
underlying Python object:
>>> import datetime
>>> datetime.date()
Traceback (most recent call last):
File "", line 1, in
TypeError: Required argument 'year' (pos 1) not found
>>> datetime.datetime()
Traceback (most recent cal
Hi all,
Here’s an issue of usability that if fixed could make usage of custom fields
simpler.
Right now fields don’t allow a built-in defaults, and you need to explicitly
set the default parameter for model fields. The problem is that this adds a
ton of boilerplate code.
Using the Polls tuto