Git Product home page Git Product logo

Comments (5)

SmileyChris avatar SmileyChris commented on August 22, 2024

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.

SmileyChris avatar SmileyChris commented on August 22, 2024

body: What about the validation?
created_at: '2011-02-11 04:33:49+00:00'
user: ! 'Evgeny Fadeev'
number: 368078

from django-countries.

SmileyChris avatar SmileyChris commented on August 22, 2024

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.

SmileyChris avatar SmileyChris commented on August 22, 2024

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.

SmileyChris avatar SmileyChris commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.