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

magic-removal: related classes methods now added

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1650 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams
2005-12-14 21:30:49 +00:00
parent ecc57b0b07
commit 765abe8f70
3 changed files with 88 additions and 63 deletions

View File

@@ -5,6 +5,7 @@ Any method you add to a model will be available to instances.
"""
from django.db import models
import datetime
class Article(models.Model):
headline = models.CharField(maxlength=100)
@@ -17,7 +18,7 @@ class Article(models.Model):
return self.pub_date == datetime.date.today()
def get_articles_from_same_day_1(self):
return self.objects.get_list(id__ne=self.id, pub_date__exact=self.pub_date)
return Article.objects.get_list(id__ne=self.id, pub_date__exact=self.pub_date)
def get_articles_from_same_day_2(self):
"""