class Meta(object): model = Direccion widgets = { 'estado': MXStateSelect(), 'municipio': selectable.AutoComboboxSelectWidget( lookup_class=MunicipioLookup, ), 'colonia': selectable.AutoComboboxSelectWidget(lookup_class=ColoniaLookup, ), } exclude = ('', )
def test_MXStateSelect(self): f = MXStateSelect() out = '''<select name="state"> <option value="AGU">Aguascalientes</option> <option value="BCN">Baja California</option> <option value="BCS">Baja California Sur</option> <option value="CAM">Campeche</option> <option value="CHH">Chihuahua</option> <option value="CHP">Chiapas</option> <option value="COA">Coahuila</option> <option value="COL">Colima</option> <option value="DIF">Distrito Federal</option> <option value="DUR">Durango</option> <option value="GRO">Guerrero</option> <option value="GUA">Guanajuato</option> <option value="HID">Hidalgo</option> <option value="JAL">Jalisco</option> <option value="MEX">Estado de México</option> <option value="MIC" selected="selected">Michoacán</option> <option value="MOR">Morelos</option> <option value="NAY">Nayarit</option> <option value="NLE">Nuevo León</option> <option value="OAX">Oaxaca</option> <option value="PUE">Puebla</option> <option value="QUE">Querétaro</option> <option value="ROO">Quintana Roo</option> <option value="SIN">Sinaloa</option> <option value="SLP">San Luis Potosí</option> <option value="SON">Sonora</option> <option value="TAB">Tabasco</option> <option value="TAM">Tamaulipas</option> <option value="TLA">Tlaxcala</option> <option value="VER">Veracruz</option> <option value="YUC">Yucatán</option> <option value="ZAC">Zacatecas</option> </select>''' self.assertHTMLEqual(f.render('state', 'MIC'), out)