~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to tests/modeltests/custom_methods/models.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant, Eddy Mulyono
  • Date: 2008-09-16 12:18:47 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080916121847-mg225rg5mnsdqzr0
Tags: 1.0-1ubuntu1
* Merge from Debian (LP: #264191), remaining changes:
  - Run test suite on build.

[Eddy Mulyono]
* Update patch to workaround network test case failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import datetime
9
9
 
10
10
class Article(models.Model):
11
 
    headline = models.CharField(maxlength=100)
 
11
    headline = models.CharField(max_length=100)
12
12
    pub_date = models.DateField()
13
13
 
14
 
    def __str__(self):
 
14
    def __unicode__(self):
15
15
        return self.headline
16
16
 
17
17
    def was_published_today(self):
31
31
            SELECT id, headline, pub_date
32
32
            FROM custom_methods_article
33
33
            WHERE pub_date = %s
34
 
                AND id != %s""", [str(self.pub_date), self.id])
 
34
                AND id != %s""", [connection.ops.value_to_db_date(self.pub_date),
 
35
                                  self.id])
35
36
        # The asterisk in "(*row)" tells Python to expand the list into
36
37
        # positional arguments to Article().
37
38
        return [self.__class__(*row) for row in cursor.fetchall()]