2007-04-06 02:25:58 +00:00
|
|
|
from django.db import models
|
2007-07-20 12:07:58 +00:00
|
|
|
from django.contrib.auth.models import User
|
2007-04-06 02:25:58 +00:00
|
|
|
|
|
|
|
class Animal(models.Model):
|
2007-08-05 05:14:46 +00:00
|
|
|
name = models.CharField(max_length=150)
|
|
|
|
latin_name = models.CharField(max_length=150)
|
2007-04-06 02:25:58 +00:00
|
|
|
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.common_name
|
2007-04-06 02:25:58 +00:00
|
|
|
|
2007-04-17 11:11:26 +00:00
|
|
|
class Plant(models.Model):
|
2007-08-05 05:14:46 +00:00
|
|
|
name = models.CharField(max_length=150)
|
2007-04-17 11:11:26 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
# For testing when upper case letter in app name; regression for #4057
|
|
|
|
db_table = "Fixtures_regress_plant"
|
|
|
|
|
2007-07-20 12:07:58 +00:00
|
|
|
class Stuff(models.Model):
|
2007-08-05 05:14:46 +00:00
|
|
|
name = models.CharField(max_length=20, null=True)
|
2007-07-20 12:07:58 +00:00
|
|
|
owner = models.ForeignKey(User, null=True)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return unicode(self.name) + u' is owned by ' + unicode(self.owner)
|
|
|
|
|
2007-04-06 02:25:58 +00:00
|
|
|
__test__ = {'API_TESTS':"""
|
|
|
|
>>> from django.core import management
|
|
|
|
|
|
|
|
# Load a fixture that uses PK=1
|
2007-08-16 06:06:55 +00:00
|
|
|
>>> management.call_command('loaddata', 'sequence', verbosity=0)
|
2007-04-06 02:25:58 +00:00
|
|
|
|
|
|
|
# Create a new animal. Without a sequence reset, this new object
|
|
|
|
# will take a PK of 1 (on Postgres), and the save will fail.
|
|
|
|
# This is a regression test for ticket #3790.
|
|
|
|
>>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus')
|
|
|
|
>>> animal.save()
|
|
|
|
|
2007-07-20 12:07:58 +00:00
|
|
|
###############################################
|
|
|
|
# Regression test for ticket #4558 -- pretty printing of XML fixtures
|
|
|
|
# doesn't affect parsing of None values.
|
|
|
|
|
|
|
|
# Load a pretty-printed XML fixture with Nulls.
|
2007-08-16 06:06:55 +00:00
|
|
|
>>> management.call_command('loaddata', 'pretty.xml', verbosity=0)
|
2007-07-20 12:07:58 +00:00
|
|
|
>>> Stuff.objects.all()
|
|
|
|
[<Stuff: None is owned by None>]
|
|
|
|
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
|
|
|
"""}
|