1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Avoided mixing dates and datetimes in the examples.

Refs #16023.
This commit is contained in:
Aymeric Augustin
2012-09-08 11:00:04 -04:00
parent b7d3b057f3
commit e69348b4e7
8 changed files with 34 additions and 23 deletions

View File

@@ -31,7 +31,7 @@ the file ``mysite/news/models.py``::
return self.full_name
class Article(models.Model):
pub_date = models.DateTimeField()
pub_date = models.DateField()
headline = models.CharField(max_length=200)
content = models.TextField()
reporter = models.ForeignKey(Reporter)
@@ -96,8 +96,8 @@ access your data. The API is created on the fly, no code generation necessary::
DoesNotExist: Reporter matching query does not exist. Lookup parameters were {'id': 2}
# Create an article.
>>> from datetime import datetime
>>> a = Article(pub_date=datetime.now(), headline='Django is cool',
>>> from datetime import date
>>> a = Article(pub_date=date.today(), headline='Django is cool',
... content='Yeah.', reporter=r)
>>> a.save()
@@ -140,7 +140,7 @@ as registering your model in the admin site::
from django.db import models
class Article(models.Model):
pub_date = models.DateTimeField()
pub_date = models.DateField()
headline = models.CharField(max_length=200)
content = models.TextField()
reporter = models.ForeignKey(Reporter)