Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1409 closed enhancement (fixed)

[patch] Allow callable defaults for fields

Reported by: jkocherhans@… Owned by: jkocherhans
Component: Database layer (models, ORM) Version: magic-removal
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

you should be able to do something like this:

from datetime import datetime

class Article(models.Model):
    headline = models.CharField(maxlength=100, default='Default headline')
    pub_date = models.DateTimeField(default = datetime.now)

Attachments (1)

field_defaults.diff (2.0 KB ) - added by jkocherhans 19 years ago.

Download all attachments as: .zip

Change History (3)

by jkocherhans, 19 years ago

Attachment: field_defaults.diff added

comment:1 by jkocherhans, 19 years ago

Summary: Allow callable defaults for fields[patch] Allow callable defaults for fields

comment:2 by jkocherhans, 19 years ago

Resolution: fixed
Status: newclosed

(In [2410]) magic-removal: fixed #1409

Note: See TracTickets for help on using tickets.
Back to Top