Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 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: UI/UX:

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 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by jkocherhans

comment:1 Changed 8 years ago by jkocherhans

  • Summary changed from Allow callable defaults for fields to [patch] Allow callable defaults for fields

comment:2 Changed 8 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.