Changeset 3125
- Timestamp:
- 06/13/06 22:31:34 (2 years ago)
- Files:
-
- django/trunk/docs/db-api.txt (modified) (1 diff)
- django/trunk/docs/forms.txt (modified) (2 diffs)
- django/trunk/docs/i18n.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/db-api.txt
r3096 r3125 560 560 hometown = models.ForeignKey(City) 561 561 562 class Book(m eta.Model):562 class Book(models.Model): 563 563 # ... 564 564 author = models.ForeignKey(Person) django/trunk/docs/forms.txt
r2809 r3125 15 15 because much of the time you won't need to use the lower-level APIs. Throughout 16 16 this document, we'll be working with the following model, a "place" object:: 17 18 from django.db import models 17 19 18 20 PLACE_TYPES = ( … … 23 25 ) 24 26 25 class Place(m eta.Model):26 name = m eta.CharField(maxlength=100)27 address = m eta.CharField(maxlength=100, blank=True)28 city = m eta.CharField(maxlength=50, blank=True)29 state = m eta.USStateField()30 zip_code = m eta.CharField(maxlength=5, blank=True)31 place_type = m eta.IntegerField(choices=PLACE_TYPES)27 class Place(models.Model): 28 name = models.CharField(maxlength=100) 29 address = models.CharField(maxlength=100, blank=True) 30 city = models.CharField(maxlength=50, blank=True) 31 state = models.USStateField() 32 zip_code = models.CharField(maxlength=5, blank=True) 33 place_type = models.IntegerField(choices=PLACE_TYPES) 32 34 33 35 class Admin: django/trunk/docs/i18n.txt
r3091 r3125 134 134 from django.utils.translation import gettext_lazy 135 135 136 class MyThing(m eta.Model):137 name = m eta.CharField(help_text=gettext_lazy('This is the help text'))136 class MyThing(models.Model): 137 name = models.CharField(help_text=gettext_lazy('This is the help text')) 138 138 139 139 In this example, ``gettext_lazy()`` stores a lazy reference to the string -- … … 146 146 from django.utils.translation import gettext_lazy as _ 147 147 148 class MyThing(m eta.Model):149 name = m eta.CharField(help_text=_('This is the help text'))148 class MyThing(models.Model): 149 name = models.CharField(help_text=_('This is the help text')) 150 150 151 151 Always use lazy translations in `Django models`_. And it's a good idea to add … … 156 156 from django.utils.translation import gettext_lazy as _ 157 157 158 class MyThing(m eta.Model):159 name = m eta.CharField(_('name'), help_text=_('This is the help text'))158 class MyThing(models.Model): 159 name = models.CharField(_('name'), help_text=_('This is the help text')) 160 160 class Meta: 161 161 verbose_name = _('my thing')
