Comments (5)
body: Since the value of the choice equates to False, it'll fail standard validation.
created_at: '2011-02-11 10:05:18+00:00'
user: ! 'Chris Beaven'
number: 368247
from django-countries.
body: What about the validation?
created_at: '2011-02-11 04:33:49+00:00'
user: ! 'Evgeny Fadeev'
number: 368078
from django-countries.
body: ! 'Er, try: ` country = forms.ChoiceField(choices=(('''', _(''select country'')),)
- COUNTRIES) `'
created_at: '2011-02-11 04:30:11+00:00'
user: ! 'Chris Beaven'
number: 368073
from django-countries.
body: ! "... actually the field might need validation and an addition of the "unknown
country" value.\n\n \n #!python\n \n country = forms.ChoiceField(choices=(('unknown',_('select
country')),) + COUNTRIES)\n \n def clean(self, value):\n """\n if
value == 'unknown':\n if self.required:\n raise ValidationError()\n
\ return None\n return value\n \n\nAlso one could improve the
widget, so I think there actually is room for the form field."
created_at: '2011-02-11 00:47:56+00:00'
user: ! 'Evgeny Fadeev'
number: 367912
from django-countries.
body: ! "Er, you don't really need any special form field to be able to do this. A
standard Django field works just fine:\n\n \n #!python\n \n from django
import forms\n from django_countiers.countries import COUNTRIES\n \n class
MyForm(forms.Form):\n country = forms.ChoiceField(choices=COUNTRIES)\n "
created_at: '2011-02-10 09:54:06+00:00'
user: ! 'Chris Beaven'
number: 367098
from django-countries.
Related Issues (20)
- AttributeError: 'CountryField' object has no attribute 'db_collation' when upgrading Django from 3.0 to 3.2.16 HOT 2
- Change country order based on user language
- Short country names HOT 1
- multiple=True widget + limit HOT 1
- Adding Kosovo HOT 5
- Question about validation and or documentation. HOT 1
- Turkey localization key HOT 4
- Feature Request: Filter for countries by continent HOT 1
- Martinique name in Ukraine (uk) localization.
- Uses Deprecated package since Django 3.0(django.utils.six) HOT 1
- DeprecationWarning: pkg_resources is deprecated as an API HOT 1
- Show all flag_css in single html page
- Wrong openapi spec when using country_dict=True
- Support for Python version 3.12 on PyPI HOT 6
- Consider moving to jazzband HOT 3
- Django 5.0 breakage HOT 13
- Ülke adlarını iki dilde görmek / Seeing country names in two languages HOT 2
- When setting `COUNTRIES_OVERRIDE`, allow custom flag_url HOT 1
- multiple = True does not work on serializer_fields.CountryField
- Allow null=True on a models.CountryField with multiple=True
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-countries.