/tests/modeltests/basic/models.py

https://code.google.com/p/mango-py/ · Python · 17 lines · 8 code · 3 blank · 6 comment · 0 complexity · d3916321f7e9dcbdf50a4d0358982139 MD5 · raw file

  1. # coding: utf-8
  2. """
  3. 1. Bare-bones model
  4. This is a basic model with only two non-primary-key fields.
  5. """
  6. from django.db import models, DEFAULT_DB_ALIAS, connection
  7. class Article(models.Model):
  8. headline = models.CharField(max_length=100, default='Default headline')
  9. pub_date = models.DateTimeField()
  10. class Meta:
  11. ordering = ('pub_date','headline')
  12. def __unicode__(self):
  13. return self.headline