Great Britain (gb)

Forms

GB-specific Form helpers.

class localflavor.gb.forms.GBCountySelect(attrs=None)[source]

A Select widget that uses a list of UK Counties/Regions as its choices.

class localflavor.gb.forms.GBNationSelect(attrs=None)[source]

A Select widget that uses a list of UK Nations as its choices.

class localflavor.gb.forms.GBPostcodeField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)[source]

A form field that validates its input is a UK postcode.

The regular expression used is sourced from the schema for British Standard BS7666 address types: https://data.gov.uk/education-standards/sites/default/files/CL-Address-Line-Type-v3-0.pdf

The value is uppercased and a space added in the correct place, if required.

clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

Data

This module contains various lists of regions and subdivisions in Great Britain.

Since subdivisions aren’t clear this is supposed to be the most pragmatic collection of lists as possible. Your mileage may vary.

See https://github.com/django/django-localflavor/pull/43 for a long discussion about it.

Changed in version 1.1.

localflavor.gb.gb_regions.ENGLAND_REGION_CHOICES = (('Bath and North East Somerset', 'Bath and North East Somerset'), ('Bedford', 'Bedford'), ('Berkshire', 'Berkshire'), ('Blackburn with Darwen', 'Blackburn with Darwen'), ('Blackpool', 'Blackpool'), ('Bournemouth', 'Bournemouth'), ('Brighton & Hove', 'Brighton & Hove'), ('Bristol', 'Bristol'), ('Buckinghamshire', 'Buckinghamshire'), ('Cambridgeshire', 'Cambridgeshire'), ('Central Bedfordshire', 'Central Bedfordshire'), ('Cheshire East', 'Cheshire East'), ('Cheshire West and Chester', 'Cheshire West and Chester'), ('Cornwall', 'Cornwall'), ('Cumbria', 'Cumbria'), ('Darlington', 'Darlington'), ('Derby', 'Derby'), ('Derbyshire', 'Derbyshire'), ('Devon', 'Devon'), ('Dorset', 'Dorset'), ('Durham', 'Durham'), ('East Riding of Yorkshire', 'East Riding of Yorkshire'), ('East Sussex', 'East Sussex'), ('Essex', 'Essex'), ('Gloucestershire', 'Gloucestershire'), ('Greater Manchester', 'Greater Manchester'), ('Halton', 'Halton'), ('Hampshire', 'Hampshire'), ('Hartlepool', 'Hartlepool'), ('Herefordshire', 'Herefordshire'), ('Hertfordshire', 'Hertfordshire'), ('Isle of Wight', 'Isle of Wight'), ('Kent', 'Kent'), ('Kingston upon Hull', 'Kingston upon Hull'), ('Lancashire', 'Lancashire'), ('Leicester', 'Leicester'), ('Leicestershire', 'Leicestershire'), ('Lincolnshire', 'Lincolnshire'), ('London', 'London'), ('Luton', 'Luton'), ('Medway', 'Medway'), ('Merseyside', 'Merseyside'), ('Middlesbrough', 'Middlesbrough'), ('Milton Keynes', 'Milton Keynes'), ('Norfolk', 'Norfolk'), ('North East Lincolnshire', 'North East Lincolnshire'), ('North Lincolnshire', 'North Lincolnshire'), ('North Somerset', 'North Somerset'), ('North Yorkshire', 'North Yorkshire'), ('Northamptonshire', 'Northamptonshire'), ('Northumberland', 'Northumberland'), ('Nottingham', 'Nottingham'), ('Nottinghamshire', 'Nottinghamshire'), ('Oxfordshire', 'Oxfordshire'), ('Peterborough', 'Peterborough'), ('Plymouth', 'Plymouth'), ('Poole', 'Poole'), ('Portsmouth', 'Portsmouth'), ('Redcar and Cleveland', 'Redcar and Cleveland'), ('Rutland', 'Rutland'), ('Shropshire', 'Shropshire'), ('Somerset', 'Somerset'), ('South Gloucestershire', 'South Gloucestershire'), ('South Yorkshire', 'South Yorkshire'), ('Southampton', 'Southampton'), ('Southend-on-Sea', 'Southend-on-Sea'), ('Staffordshire', 'Staffordshire'), ('Stockton-on-Tees', 'Stockton-on-Tees'), ('Stoke-on-Trent', 'Stoke-on-Trent'), ('Suffolk', 'Suffolk'), ('Surrey', 'Surrey'), ('Swindon', 'Swindon'), ('Telford and Wrekin', 'Telford and Wrekin'), ('Thurrock', 'Thurrock'), ('Torbay', 'Torbay'), ('Tyne and Wear', 'Tyne and Wear'), ('Warrington', 'Warrington'), ('Warwickshire', 'Warwickshire'), ('West Midlands', 'West Midlands'), ('West Sussex', 'West Sussex'), ('West Yorkshire', 'West Yorkshire'), ('Wiltshire', 'Wiltshire'), ('Worcestershire', 'Worcestershire'), ('York', 'York'))

Metropolitan and non-metropolitan counties of England (not the ceremonial counties) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Metropolitan_and_non-metropolitan_counties_of_England

localflavor.gb.gb_regions.GB_NATIONS_CHOICES = (('England', 'England'), ('Northern Ireland', 'Northern Ireland'), ('Wales', 'Wales'), ('Scotland', 'Scotland'))

Nations of the United Kingdom

localflavor.gb.gb_regions.GB_REGION_CHOICES = (('Bath and North East Somerset', 'Bath and North East Somerset'), ('Bedford', 'Bedford'), ('Berkshire', 'Berkshire'), ('Blackburn with Darwen', 'Blackburn with Darwen'), ('Blackpool', 'Blackpool'), ('Bournemouth', 'Bournemouth'), ('Brighton & Hove', 'Brighton & Hove'), ('Bristol', 'Bristol'), ('Buckinghamshire', 'Buckinghamshire'), ('Cambridgeshire', 'Cambridgeshire'), ('Central Bedfordshire', 'Central Bedfordshire'), ('Cheshire East', 'Cheshire East'), ('Cheshire West and Chester', 'Cheshire West and Chester'), ('Cornwall', 'Cornwall'), ('Cumbria', 'Cumbria'), ('Darlington', 'Darlington'), ('Derby', 'Derby'), ('Derbyshire', 'Derbyshire'), ('Devon', 'Devon'), ('Dorset', 'Dorset'), ('Durham', 'Durham'), ('East Riding of Yorkshire', 'East Riding of Yorkshire'), ('East Sussex', 'East Sussex'), ('Essex', 'Essex'), ('Gloucestershire', 'Gloucestershire'), ('Greater Manchester', 'Greater Manchester'), ('Halton', 'Halton'), ('Hampshire', 'Hampshire'), ('Hartlepool', 'Hartlepool'), ('Herefordshire', 'Herefordshire'), ('Hertfordshire', 'Hertfordshire'), ('Isle of Wight', 'Isle of Wight'), ('Kent', 'Kent'), ('Kingston upon Hull', 'Kingston upon Hull'), ('Lancashire', 'Lancashire'), ('Leicester', 'Leicester'), ('Leicestershire', 'Leicestershire'), ('Lincolnshire', 'Lincolnshire'), ('London', 'London'), ('Luton', 'Luton'), ('Medway', 'Medway'), ('Merseyside', 'Merseyside'), ('Middlesbrough', 'Middlesbrough'), ('Milton Keynes', 'Milton Keynes'), ('Norfolk', 'Norfolk'), ('North East Lincolnshire', 'North East Lincolnshire'), ('North Lincolnshire', 'North Lincolnshire'), ('North Somerset', 'North Somerset'), ('North Yorkshire', 'North Yorkshire'), ('Northamptonshire', 'Northamptonshire'), ('Northumberland', 'Northumberland'), ('Nottingham', 'Nottingham'), ('Nottinghamshire', 'Nottinghamshire'), ('Oxfordshire', 'Oxfordshire'), ('Peterborough', 'Peterborough'), ('Plymouth', 'Plymouth'), ('Poole', 'Poole'), ('Portsmouth', 'Portsmouth'), ('Redcar and Cleveland', 'Redcar and Cleveland'), ('Rutland', 'Rutland'), ('Shropshire', 'Shropshire'), ('Somerset', 'Somerset'), ('South Gloucestershire', 'South Gloucestershire'), ('South Yorkshire', 'South Yorkshire'), ('Southampton', 'Southampton'), ('Southend-on-Sea', 'Southend-on-Sea'), ('Staffordshire', 'Staffordshire'), ('Stockton-on-Tees', 'Stockton-on-Tees'), ('Stoke-on-Trent', 'Stoke-on-Trent'), ('Suffolk', 'Suffolk'), ('Surrey', 'Surrey'), ('Swindon', 'Swindon'), ('Telford and Wrekin', 'Telford and Wrekin'), ('Thurrock', 'Thurrock'), ('Torbay', 'Torbay'), ('Tyne and Wear', 'Tyne and Wear'), ('Warrington', 'Warrington'), ('Warwickshire', 'Warwickshire'), ('West Midlands', 'West Midlands'), ('West Sussex', 'West Sussex'), ('West Yorkshire', 'West Yorkshire'), ('Wiltshire', 'Wiltshire'), ('Worcestershire', 'Worcestershire'), ('York', 'York'), ('Antrim', 'Antrim'), ('Armagh', 'Armagh'), ('Down', 'Down'), ('Fermanagh', 'Fermanagh'), ('Londonderry', 'Londonderry'), ('Tyrone', 'Tyrone'), ('Blaenau Gwent', 'Blaenau Gwent'), ('Bridgend', 'Bridgend'), ('Caerphilly', 'Caerphilly'), ('Cardiff', 'Cardiff'), ('Carmarthenshire', 'Carmarthenshire'), ('Ceredigion', 'Ceredigion'), ('Conwy', 'Conwy'), ('Denbighshire', 'Denbighshire'), ('Flintshire', 'Flintshire'), ('Gwynedd', 'Gwynedd'), ('Isle of Anglesey', 'Isle of Anglesey'), ('Merthyr Tydfil', 'Merthyr Tydfil'), ('Monmouthshire', 'Monmouthshire'), ('Neath Port Talbot', 'Neath Port Talbot'), ('Newport', 'Newport'), ('Pembrokeshire', 'Pembrokeshire'), ('Powys', 'Powys'), ('Rhondda Cynon Taf', 'Rhondda Cynon Taf'), ('Swansea', 'Swansea'), ('Torfaen', 'Torfaen'), ('Vale of Glamorgan', 'Vale of Glamorgan'), ('Wrexham', 'Wrexham'), ('Aberdeen City', 'Aberdeen City'), ('Aberdeenshire', 'Aberdeenshire'), ('Angus', 'Angus'), ('Argyll and Bute', 'Argyll and Bute'), ('Clackmannanshire', 'Clackmannanshire'), ('Dumfries and Galloway', 'Dumfries and Galloway'), ('Dundee City', 'Dundee City'), ('East Ayrshire', 'East Ayrshire'), ('East Dunbartonshire', 'East Dunbartonshire'), ('East Lothian', 'East Lothian'), ('East Renfrewshire', 'East Renfrewshire'), ('Edinburgh, City of ', 'Edinburgh, City of'), ('Falkirk', 'Falkirk'), ('Fife', 'Fife'), ('Glasgow City', 'Glasgow City'), ('Highland', 'Highland'), ('Inverclyde', 'Inverclyde'), ('Midlothian', 'Midlothian'), ('Moray', 'Moray'), ('North Ayrshire', 'North Ayrshire'), ('North Lanarkshire', 'North Lanarkshire'), ('Perth and Kinross', 'Perth and Kinross'), ('Renfrewshire', 'Renfrewshire'), ('Scottish Borders', 'Scottish Borders'), ('South Ayrshire', 'South Ayrshire'), ('South Lanarkshire', 'South Lanarkshire'), ('Stirling', 'Stirling'), ('West Dunbartonshire', 'West Dunbartonshire'), ('West Lothian', 'West Lothian'), ('Na h-Eileanan Siar', 'Na h-Eileanan Siar'), ('Orkney Islands', 'Orkney Islands'), ('Shetland Islands', 'Shetland Islands'))

All regions of United Kingdom

localflavor.gb.gb_regions.NORTHERN_IRELAND_REGION_CHOICES = (('Antrim', 'Antrim'), ('Armagh', 'Armagh'), ('Down', 'Down'), ('Fermanagh', 'Fermanagh'), ('Londonderry', 'Londonderry'), ('Tyrone', 'Tyrone'))

Counties of Northern Ireland (not the more recent, but less well-known, districts of Northern Ireland) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Counties_of_Northern_Ireland

localflavor.gb.gb_regions.SCOTTISH_REGION_CHOICES = (('Aberdeen City', 'Aberdeen City'), ('Aberdeenshire', 'Aberdeenshire'), ('Angus', 'Angus'), ('Argyll and Bute', 'Argyll and Bute'), ('Clackmannanshire', 'Clackmannanshire'), ('Dumfries and Galloway', 'Dumfries and Galloway'), ('Dundee City', 'Dundee City'), ('East Ayrshire', 'East Ayrshire'), ('East Dunbartonshire', 'East Dunbartonshire'), ('East Lothian', 'East Lothian'), ('East Renfrewshire', 'East Renfrewshire'), ('Edinburgh, City of ', 'Edinburgh, City of'), ('Falkirk', 'Falkirk'), ('Fife', 'Fife'), ('Glasgow City', 'Glasgow City'), ('Highland', 'Highland'), ('Inverclyde', 'Inverclyde'), ('Midlothian', 'Midlothian'), ('Moray', 'Moray'), ('North Ayrshire', 'North Ayrshire'), ('North Lanarkshire', 'North Lanarkshire'), ('Perth and Kinross', 'Perth and Kinross'), ('Renfrewshire', 'Renfrewshire'), ('Scottish Borders', 'Scottish Borders'), ('South Ayrshire', 'South Ayrshire'), ('South Lanarkshire', 'South Lanarkshire'), ('Stirling', 'Stirling'), ('West Dunbartonshire', 'West Dunbartonshire'), ('West Lothian', 'West Lothian'), ('Na h-Eileanan Siar', 'Na h-Eileanan Siar'), ('Orkney Islands', 'Orkney Islands'), ('Shetland Islands', 'Shetland Islands'))

Council areas of Scotland Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Subdivisions_of_Scotland#Council_areas

localflavor.gb.gb_regions.WALES_REGION_CHOICES = (('Blaenau Gwent', 'Blaenau Gwent'), ('Bridgend', 'Bridgend'), ('Caerphilly', 'Caerphilly'), ('Cardiff', 'Cardiff'), ('Carmarthenshire', 'Carmarthenshire'), ('Ceredigion', 'Ceredigion'), ('Conwy', 'Conwy'), ('Denbighshire', 'Denbighshire'), ('Flintshire', 'Flintshire'), ('Gwynedd', 'Gwynedd'), ('Isle of Anglesey', 'Isle of Anglesey'), ('Merthyr Tydfil', 'Merthyr Tydfil'), ('Monmouthshire', 'Monmouthshire'), ('Neath Port Talbot', 'Neath Port Talbot'), ('Newport', 'Newport'), ('Pembrokeshire', 'Pembrokeshire'), ('Powys', 'Powys'), ('Rhondda Cynon Taf', 'Rhondda Cynon Taf'), ('Swansea', 'Swansea'), ('Torfaen', 'Torfaen'), ('Vale of Glamorgan', 'Vale of Glamorgan'), ('Wrexham', 'Wrexham'))

Principal areas of Wales (not the preserved or historic counties) Retrieved 10th Nov 2014 from http://en.wikipedia.org/wiki/Local_government_in_Wales