summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-02-20 02:59:16 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-02-20 02:59:16 +0000
commitbdfbcb2cd51643d2d866eda8820b62521901a007 (patch)
tree13ac257f6fb2d72fdb126ffc28fdda47ac64922e /tests
parente56934b9b903535ace50f46d892dab4225b67f61 (diff)
Fixed #3247 -- newforms form_for_model() and form_for_instance() no longer create form fields for database fields with editable=False. Thanks for the patch, mssnlayam@yahoo.com and Philipp Keller
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_forms/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index c7ac44842a..63ec511838 100644
--- a/tests/modeltests/model_forms/models.py
+++ b/tests/modeltests/model_forms/models.py
@@ -40,10 +40,17 @@ class Writer(models.Model):
class Article(models.Model):
headline = models.CharField(maxlength=50)
pub_date = models.DateField()
+ created = models.DateField(editable=False)
writer = models.ForeignKey(Writer)
article = models.TextField()
categories = models.ManyToManyField(Category, blank=True)
+ def save(self):
+ import datetime
+ if not self.id:
+ self.created = datetime.date.today()
+ return super(Article, self).save()
+
def __str__(self):
return self.headline