Skip to content

Instantly share code, notes, and snippets.

@Fcmam5
Last active September 12, 2024 13:57
Show Gist options
  • Select an option

  • Save Fcmam5/69cce34be06f07123655daa82c7cf7a8 to your computer and use it in GitHub Desktop.

Select an option

Save Fcmam5/69cce34be06f07123655daa82c7cf7a8 to your computer and use it in GitHub Desktop.
Algerian administrative devisions (Wilaya-ولايات الجزائر) as constant for Django choice field
from django.utils.translation import gettext_lazy as _
WILAYAS = [
( 0, 'International'),
( 1, '01- {}'.format(_('Adrar')) ),
( 2, '02- {}'.format(_('Chlef')) ),
( 3, '03- {}'.format(_('Laghouat')) ),
( 4, '04- {}'.format(_('Oum El Bouaghi')) ),
( 5, '05- {}'.format(_('Batna')) ),
( 6, '06- {}'.format(_('Béjaïa')) ),
( 7, '07- {}'.format(_('Biskra')) ),
( 8, '08- {}'.format(_('Bechar')) ),
( 9, '09- {}'.format(_('Blida')) ),
( 10, '10- {}'.format(_('Bouira')) ),
( 11, '11- {}'.format(_('Tamanrasset')) ),
( 12, '12- {}'.format(_('Tebessa')) ),
( 13, '13- {}'.format(_('Tlemcen')) ),
( 14, '14- {}'.format(_('Tiaret')) ),
( 15, '15- {}'.format(_('Tizi Ouzou')) ),
( 16, '16- {}'.format(_('Alger')) ),
( 17, '17- {}'.format(_('Djelfa')) ),
( 18, '18- {}'.format(_('Jijel')) ),
( 19, '19- {}'.format(_('Setif')) ),
( 20, '20- {}'.format(_('Saida')) ),
( 21, '21- {}'.format(_('Skikda')) ),
( 22, '22- {}'.format(_('Sidi bel abbes')) ),
( 23, '23- {}'.format(_('Annaba')) ),
( 24, '24- {}'.format(_('Guelma')) ),
( 25, '25- {}'.format(_('Constantine')) ),
( 26, '26- {}'.format(_('Medea')) ),
( 27, '27- {}'.format(_('Mostaghanem')) ),
( 28, '28- {}'.format(_('Msila')) ),
( 29, '29- {}'.format(_('Mascara')) ),
( 30, '30- {}'.format(_('Ouargla')) ),
( 31, '31- {}'.format(_('Oran')) ),
( 32, '32- {}'.format(_('El Bayedh')) ),
( 33, '33- {}'.format(_('Illizi')) ),
( 34, '34- {}'.format(_('Bordj Bou Arreridj')) ),
( 35, '35- {}'.format(_('Boumerdes')) ),
( 36, '36- {}'.format(_('El Taref')) ),
( 37, '37- {}'.format(_('Tindouf')) ),
( 38, '38- {}'.format(_('Tissemsilt')) ),
( 39, '39- {}'.format(_('El Oued')) ),
( 40, '40- {}'.format(_('Khenchla')) ),
( 41, '41- {}'.format(_('Souk Ahras')) ),
( 42, '42- {}'.format(_('Tipaza')) ),
( 43, '43- {}'.format(_('Mila')) ),
( 44, '44- {}'.format(_('Ain Defla')) ),
( 45, '45- {}'.format(_('Naama')) ),
( 46, '46- {}'.format(_('Ain Timouchent')) ),
( 47, '47- {}'.format(_('Ghardaïa')) ),
( 48, '48- {}'.format(_('Relizane')) )
]
from django.db import models
from django.utils.translation import gettext_lazy as _
from .constants import WILAYAS
class Distributor(models.Model):
distributor_name = models.CharField(_('Name'), max_length=100)
address = models.CharField(_('Address'), max_length=200)
wilaya = models.IntegerField(_('Wilaya'), choices=WILAYAS)
@Wise-Cpt
Copy link

The new Wilayas 58 ones:
WILAYAS = [
( 0, 'International'),
( 1, '01- {}'.format(('Adrar')) ),
( 2, '02- {}'.format(
('Chlef')) ),
( 3, '03- {}'.format(('Laghouat')) ),
( 4, '04- {}'.format(
('Oum El Bouaghi')) ),
( 5, '05- {}'.format(('Batna')) ),
( 6, '06- {}'.format(
('Béjaïa')) ),
( 7, '07- {}'.format(('Biskra')) ),
( 8, '08- {}'.format(
('Bechar')) ),
( 9, '09- {}'.format(('Blida')) ),
( 10, '10- {}'.format(
('Bouira')) ),
( 11, '11- {}'.format(('Tamanrasset')) ),
( 12, '12- {}'.format(
('Tebessa')) ),
( 13, '13- {}'.format(('Tlemcen')) ),
( 14, '14- {}'.format(
('Tiaret')) ),
( 15, '15- {}'.format(('Tizi Ouzou')) ),
( 16, '16- {}'.format(
('Alger')) ),
( 17, '17- {}'.format(('Djelfa')) ),
( 18, '18- {}'.format(
('Jijel')) ),
( 19, '19- {}'.format(('Setif')) ),
( 20, '20- {}'.format(
('Saida')) ),
( 21, '21- {}'.format(('Skikda')) ),
( 22, '22- {}'.format(
('Sidi bel abbes')) ),
( 23, '23- {}'.format(('Annaba')) ),
( 24, '24- {}'.format(
('Guelma')) ),
( 25, '25- {}'.format(('Constantine')) ),
( 26, '26- {}'.format(
('Medea')) ),
( 27, '27- {}'.format(('Mostaghanem')) ),
( 28, '28- {}'.format(
('Msila')) ),
( 29, '29- {}'.format(('Mascara')) ),
( 30, '30- {}'.format(
('Ouargla')) ),
( 31, '31- {}'.format(('Oran')) ),
( 32, '32- {}'.format(
('El Bayedh')) ),
( 33, '33- {}'.format(('Illizi')) ),
( 34, '34- {}'.format(
('Bordj Bou Arreridj')) ),
( 35, '35- {}'.format(('Boumerdes')) ),
( 36, '36- {}'.format(
('El Taref')) ),
( 37, '37- {}'.format(('Tindouf')) ),
( 38, '38- {}'.format(
('Tissemsilt')) ),
( 39, '39- {}'.format(('El Oued')) ),
( 40, '40- {}'.format(
('Khenchla')) ),
( 41, '41- {}'.format(('Souk Ahras')) ),
( 42, '42- {}'.format(
('Tipaza')) ),
( 43, '43- {}'.format(('Mila')) ),
( 44, '44- {}'.format(
('Ain Defla')) ),
( 45, '45- {}'.format(('Naama')) ),
( 46, '46- {}'.format(
('Ain Timouchent')) ),
( 47, '47- {}'.format(('Ghardaïa')) ),
( 48, '48- {}'.format(
('Relizane')) ),
( 49, '49- {}'.format(('Timimoun')) ),
( 50, '50- {}'.format(
('Bordj Badji Mokhtar')) ),
( 51, '51- {}'.format(('Ouled Djellal')) ),
( 52, '52- {}'.format(
('Beni Abbes')) ),
( 53, '53- {}'.format(('I Salah')) ),
( 54, '54- {}'.format(
('In Guezzam')) ),
( 55, '55- {}'.format(('Touggourt')) ),
( 56, '56- {}'.format(
('Djanet')) ),
( 57, '57- {}'.format(('El MGhair')) ),
( 58, '58- {}'.format(
('El Meniaa')) )
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment