Ticket #8210: 8210-1.diff
File 8210-1.diff, 6.0 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/__init__.py
842 842 defaults.update(kwargs) 843 843 return super(URLField, self).formfield(**defaults) 844 844 845 class USStateField(Field):846 def get_internal_type(self):847 return "USStateField"848 849 def formfield(self, **kwargs):850 from django.contrib.localflavor.us.forms import USStateSelect851 defaults = {'widget': USStateSelect}852 defaults.update(kwargs)853 return super(USStateField, self).formfield(**defaults)854 855 845 class XMLField(TextField): 856 846 def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs): 857 847 self.schema_path = schema_path -
django/contrib/gis/utils/layermapping.py
118 118 OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime 119 119 from django.contrib.gis.models import GeometryColumns, SpatialRefSys 120 120 from django.db import models, transaction 121 from django.contrib.localflavor.us.models import USStateField 121 122 122 123 # LayerMapping exceptions. 123 124 class LayerMapError(Exception): pass … … 150 151 models.SlugField : OFTString, 151 152 models.TextField : OFTString, 152 153 models.URLField : OFTString, 153 models.USStateField : OFTString,154 USStateField : OFTString, 154 155 models.XMLField : OFTString, 155 156 models.SmallIntegerField : (OFTInteger, OFTReal, OFTString), 156 157 models.PositiveSmallIntegerField : (OFTInteger, OFTReal, OFTString), -
django/contrib/gis/tests/relatedapp/models.py
1 1 from django.contrib.gis.db import models 2 from django.contrib.localflavor.us.models import USStateField 2 3 3 4 class Location(models.Model): 4 5 name = models.CharField(max_length=50) … … 7 8 8 9 class City(models.Model): 9 10 name = models.CharField(max_length=50) 10 state = models.USStateField()11 state = USStateField() 11 12 location = models.ForeignKey(Location) 12 13 objects = models.GeoManager() -
django/contrib/localflavor/us/models.py
1 from django.db.models.fields import Field 2 3 class USStateField(Field): 4 def get_internal_type(self): 5 return "USStateField" 6 7 def formfield(self, **kwargs): 8 from django.contrib.localflavor.us.forms import USStateSelect 9 defaults = {'widget': USStateSelect} 10 defaults.update(kwargs) 11 return super(USStateField, self).formfield(**defaults) -
tests/regressiontests/serializers_regress/models.py
8 8 from django.db import models 9 9 from django.contrib.contenttypes import generic 10 10 from django.contrib.contenttypes.models import ContentType 11 from django.contrib.localflavor.us.models import USStateField 11 12 12 13 # The following classes are for testing basic data 13 14 # marshalling, including NULL values. … … 73 74 data = models.TimeField(null=True) 74 75 75 76 class USStateData(models.Model): 76 data = models.USStateField(null=True)77 data = USStateField(null=True) 77 78 78 79 class XMLData(models.Model): 79 80 data = models.XMLField(null=True) … … 209 210 # data = models.TimeField(primary_key=True) 210 211 211 212 class USStatePKData(models.Model): 212 data = models.USStateField(primary_key=True)213 data = USStateField(primary_key=True) 213 214 214 215 # class XMLPKData(models.Model): 215 216 # data = models.XMLField(primary_key=True) -
docs/topics/forms/modelforms.txt
73 73 ``TimeField`` ``TimeField`` 74 74 ``URLField`` ``URLField`` with ``verify_exists`` set 75 75 to the model field's ``verify_exists`` 76 ``USStateField`` ``CharField`` with77 ``widget=USStateSelect``78 (``USStateSelect`` is from79 ``django.contrib.localflavor.us``)80 76 ``XMLField`` ``CharField`` with ``widget=Textarea`` 81 77 =============================== ======================================== 82 78 -
docs/ref/contrib/localflavor.txt
649 649 650 650 A form ``Select`` widget that uses a list of U.S. states/territories as its 651 651 choices. 652 653 .. class:: us.models.USStateField 654 655 A model field that forms represent as a ``forms.USStateField`` field and 656 stores the two-letter U.S. state abbreviation in the database. -
docs/ref/models/fields.txt
705 705 :attr:`~CharField.max_length`argument. If you don't specify 706 706 :attr:`~CharField.max_length`, a default of 200 is used. 707 707 708 ``USStateField``709 ----------------710 711 .. class:: USStateField([**options])712 713 A two-letter U.S. state abbreviation. The admin represents this as an ``<input714 type="text">`` (a single-line input).715 716 708 ``XMLField`` 717 709 ------------ 718 710