Opened 15 years ago

Closed 14 years ago

Last modified 12 years ago

#9289 closed (fixed)

Swedish (se) localflavor

Reported by: Andreas Pelme Owned by:
Component: contrib.localflavor Version: dev
Severity: Keywords: localflavor, sv, se
Cc: hwaara@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The attached patch contains:

  • SECountySelect - Select widget for Swedish counties (län)
  • SEMunicipalitySelect - Select widget for Swedish municipalities (kommun)
  • SEOrganisationNumber - Form field for Swedish Organisation numbers (organisationsnummer)
  • SEPersonalIdentityNumber - Form field for Swedish Identity numbers (personnummer)

Documentation, Swedish translations, and tests that covers all widgets fields are included!

Attachments (6)

django_localflavor_se.diff (51.4 KB) - added by Andreas Pelme 15 years ago.
Swedish localflavor patch against current trunk
django_localflavor_se_r2.diff (23.2 KB) - added by Andreas Pelme 15 years ago.
Updated patch
django_localflavor_se_r3.diff (23.5 KB) - added by Andreas Pelme 15 years ago.
Updated patch which works when the checksum digit is 0, tests updated.
django_localflavor_se_r4.diff (23.1 KB) - added by Andreas Pelme 15 years ago.
Updated patch according to the discussion on django-se. The counties are not appended by "County", and not marked for translation.
django_localflavor_se_r5.diff (23.0 KB) - added by Ludvig Ericson 15 years ago.
Some typo changes, and made using svn diff instead.
django_localflavor_se_r6.diff (23.1 KB) - added by Ludvig Ericson 15 years ago.
Marked strings for translation, because some languages have non-roman alphabets.

Download all attachments as: .zip

Change History (25)

Changed 15 years ago by Andreas Pelme

Attachment: django_localflavor_se.diff added

Swedish localflavor patch against current trunk

comment:1 Changed 15 years ago by Andreas Pelme

I forgot to mention in the description above, the patch also contains:

  • SEPostalCodeNumberField - Form field for Swedish postal codes

comment:2 Changed 15 years ago by Ludvig Ericson

I somehow feel that you aren't entitled to patching my /dev/null. :-)

comment:3 Changed 15 years ago by Ludvig Ericson

Patch needs improvement: set

When making a patch for Django, do it like this: (Assuming your Django is in ~/django-trunk)

# Make some edits.
cd django-trunk
vim ...
# Then make patch:
svn diff >~/django-foo.diff

and upload that .diff. This makes it easier for the committers.

comment:4 in reply to:  3 Changed 15 years ago by Andreas Pelme

Patch needs improvement: unset

Replying to toxik:

When making a patch for Django, do it like this: ... and upload that .diff. This makes it easier for the committers.

The trac patch-viewer has problems showing patches from "git diff", which is an acceptable format for patches according to
http://docs.djangoproject.com/en/dev/internals/contributing/#patch-style

Download the patch and view it with your favourite text editor and you will see the correct file names.

comment:5 Changed 15 years ago by Andreas Pelme

comment:6 Changed 15 years ago by Malcolm Tredinnick

Patch needs improvement: set

I think putting in all the municipalities is going a bit too far here. We aren't intending to be an encyclopedic reference. What happens when somebody wants to include every town in the US? Where do we draw the line? I think some of these things -- municipalities (when there are 290 of them), towns, postcodes, etc -- probably just have to be some kind of optional third-party package. Otherwise Django is going to be a huge download.

Also, please remove the translation update. That isn't part of the localflavor and can be done in the normal course of doing a translation update.

comment:7 Changed 15 years ago by Andreas Pelme

Patch needs improvement: unset
Status: newassigned
Triage Stage: UnreviewedAccepted

Updated patch which...

  • Validates personal identity numbers according to the discussion on the Swedish mailing list
  • The cleaned value returns the full year and no sign
  • Tests and documentation are updated accordingly
  • Adds some more validation checking for SEOrganisationNumberField.
  • SEMunicipalitySelect removed
  • All translation changes removed

I haven't got any feedback on
http://groups.google.com/group/django-developers/browse_thread/thread/ad5a7866ed5f471b
so I have not done any work on a model field/extra methods for converting between long and short formats and datetime.date objects (which should be trivial once it's decided).

Changed 15 years ago by Andreas Pelme

Updated patch

Changed 15 years ago by Andreas Pelme

Updated patch which works when the checksum digit is 0, tests updated.

comment:8 Changed 15 years ago by anonymous

Cc: hwaara@… added

Changed 15 years ago by Andreas Pelme

Updated patch according to the discussion on django-se. The counties are not appended by "County", and not marked for translation.

Changed 15 years ago by Ludvig Ericson

Some typo changes, and made using svn diff instead.

comment:9 Changed 15 years ago by Ludvig Ericson

Owner: changed from Andreas Pelme to Malcolm Tredinnick
Status: assignednew

Oh and assign these things to Malcolm.

comment:10 Changed 15 years ago by Malcolm Tredinnick

Owner: Malcolm Tredinnick deleted

There's no reason to assign this to me.

comment:11 Changed 15 years ago by Ludvig Ericson

Oh, well then. I stand corrected. I also couldn't delete owner like that.

Changed 15 years ago by Ludvig Ericson

Marked strings for translation, because some languages have non-roman alphabets.

comment:12 Changed 15 years ago by anonymous

What's the next step here, is the patch updated according to the discussions in the newsgroup? Is it ready for review?

comment:13 Changed 15 years ago by Andreas Pelme

Yes, it is updated according to the discussions. I would say it is ready for review. I use the code myself in a couple of projects and have no issues with it.

comment:14 Changed 15 years ago by anonymous

Can we get this into 1.1 pretty please? The patch looks done...

comment:15 Changed 15 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:16 Changed 15 years ago by Andreas Pelme

milestone: 1.1

comment:17 Changed 15 years ago by Alex Gaynor

milestone: 1.11.2

We're now past feature freeze, this will have to wait until 1.2 :(

comment:18 Changed 14 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [11969]) Fixed #9289 - Added Swedish localflavor. Thanks to Andreas Pelme, Ludvig Ericson and Filip Noetzel for working on a patch.

comment:19 Changed 12 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top