Skip to content

Fix MX curp field#449

Merged
benkonrath merged 2 commits intodjango:masterfrom
quevon24:fix-mx-curp
Aug 26, 2021
Merged

Fix MX curp field#449
benkonrath merged 2 commits intodjango:masterfrom
quevon24:fix-mx-curp

Conversation

@quevon24
Copy link
Copy Markdown
Contributor

Correct regex to validate MX CURP is:

curp_re = (r'^[A-Z][AEIOUX][A-Z]{2}%s[HM]%s%s{3}[0-9A-Z]\d$' %
                   (DATE_RE, states_re, consonants_re))

It needs an X because the second character is the first vowel of the first last name(surname), in the case that there is no vowel, CURP comes with an X, e.g: For example mayan last name 'OY'() second char is a consonant, not vowel, so the the beginning of the curp it's OX and it's not valid with actual regex.

@quevon24 quevon24 changed the title fFx mx curp field Fix mx curp field Aug 23, 2021
@quevon24 quevon24 changed the title Fix mx curp field Fix MX curp field Aug 23, 2021
@benkonrath
Copy link
Copy Markdown
Member

Thanks for the PR. A couple of points:

  • Could you add an example of a valid CURP with an X to the CURP test? This helps to double check the fix.
  • We also need an entry to the change log for this bug fix.
  • [optional] You can add you name to the authors file if you want.

Thanks again for the fix!

@quevon24
Copy link
Copy Markdown
Contributor Author

Thanks, I commited the new changes with what you ask for. I added an example to test_MXCURPField and the new entry on changelog.

And thanks for this incredible package. 👍

@benkonrath benkonrath merged commit 2d46207 into django:master Aug 26, 2021
@benkonrath
Copy link
Copy Markdown
Member

benkonrath commented Aug 26, 2021

Thanks! ✋ (high five)

netbsd-srcmastr referenced this pull request in NetBSD/pkgsrc Dec 2, 2023
4.0   (2023-04-22)
------------------

New flavors:

- Nepal LocalFlavor: Support for Nepal added
  (`gh-451 <https://github.com/django/django-localflavor/pull/451>`_).
- Belarus localflavor
  (`gh-422 <https://github.com/django/django-localflavor/pull/422>`_,
  `gh-442 <https://github.com/django/django-localflavor/pull/442>`_).
- Ghana localflavor
  (`gh-460 <https://github.com/django/django-localflavor/pull/460>`_).

New fields for existing flavors:

- Added `fr.forms.FRRNAField` models field
  (`gh-443 <https://github.com/django/django-localflavor/pull/443>`_).
- Added permanent account number(PAN) field in Indian flavor.
  (`gh-457 <https://github.com/django/django-localflavor/pull/457>`_).
- Added the Canadian Models fields.
  (`gh-465 <https://github.com/django/django-localflavor/pull/465>`_).

Modifications to existing flavors:

- Properly validate IBANs using BBAN to ensure invalid IBANs cannot be entered,
  updated IBAN_SEPA_COUNTRIES and IBAN_COUNTRY_CODE_LENGTH to latest data
  (`gh-486 <https://github.com/django/django-localflavor/pull/486>`_).
- Fix typo in Marijampolė county name in LTCountySelect
  (`gh-480 <https://github.com/django/django-localflavor/pull/480>`_).
- Add support for new Finnish identity codes
  (`gh-478 <https://github.com/django/django-localflavor/pull/478>`_).
- CIF spanish starting with 'U' bug resolved
  (`gh-469 <https://github.com/django/django-localflavor/pull/469>`_).
- Fix error code for BRPostalCodeValidator
  (`gh-448 <https://github.com/django/django-localflavor/pull/448>`_).
- Fix spelling of the India state of Chhattisgarh
  (`gh-444 <https://github.com/django/django-localflavor/pull/444>`_).
- Fix CURP regex for MX flavor
  (`gh-449 <https://github.com/django/django-localflavor/pull/449>`_).
- Change text based fields that inherited from `django.forms.Field` to inherit from `django.forms.CharField`. The
  following fields have been updated
  (`gh-446 <https://github.com/django/django-localflavor/pull/446>`_):

  - `at.forms.ATSocialSecurityNumberField`
  - `br.forms.BRStateChoiceField`
  - `ca.forms.CAProvinceField`
  - `ca.forms.CASocialInsuranceNumberField`
  - `ch.forms.CHIdentityCardNumberField`
  - `cu.forms.CUProvinceField`
  - `cu.forms.CURegionField`
  - `cz.forms.CZBirthNumberField`
  - `cz.forms.CZICNumberField`
  - `de.forms.DEIdentityCardNumberField`
  - `ee.forms.EEBusinessRegistryCode`
  - `ee.forms.EEPersonalIdentificationCode`
  - `fi.forms.FISocialSecurityNumber`
  - `gr.forms.GRTaxNumberCodeField`
  - `hr.forms.HRJMBAGField`
  - `hr.forms.HRJMBGField`
  - `hr.forms.HRLicensePlateField`
  - `hr.forms.HRPostalCodeField`
  - `id_.forms.IDLicensePlateField`
  - `id_.forms.IDNationalIdentityNumberField`
  - `id_.forms.IDPostCodeField`
  - `il.forms.ILIDNumberField`
  - `in_.forms.INAadhaarNumberField`
  - `in_.forms.INStateField`
  - `ir.forms.IRIDNumberField`
  - `it.forms.ITVatNumberField`
  - `lt.forms.LTPostalCodeField`
  - `lv.forms.LVPersonalCodeField`
  - `lv.forms.LVPostalCodeField`
  - `no.forms.NOSocialSecurityNumber`
  - `nz.forms.NZBankAccountNumberField`
  - `pt.forms.PTCitizenCardNumberField`
  - `pt.forms.PTSocialSecurityNumberField`
  - `ro.forms.ROCountyField`
  - `tr.forms.TRIdentificationNumberField`
  - `us.forms.USStateField`
- Removed inconvenient word VACA from CURP_INCONVENIENT_WORDS for MX flavor

Other changes:

- Use 'return value' when value is in the empty_values list
  (`gh-461 <https://github.com/django/django-localflavor/pull/461>`_).

- Dropped support for Django 2.2, 3.0 and 3.1.

- Dropped support for Python 3.5.

- Added support for Python 3.10 and 3.11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants