django-institutions
A Django application that provides a university institution field for models and a serializer.
Installation
pip install django-institutions- Add
django_institutionsto yourINSTALLED_APPS
Usage
InstitutionField
An institution field for Django models with choices from:
https://github.com/Hipo/university-domains-list
InstitutionField is based on Django's CharField.
Consider the following model user InstitutionField:
from django.db import models
from django_institutions.fields import InstitutionField
class User(models.Model):
name = models.CharField(max_length=255)
institution = InstitutionField()
A User instance will have a institution attribute where you can get the details of the institution.
>>> user = User(name='John Doe', institution='University of London')
>>> user.institution
Institution(name='University of London', country='United Kingdom', etc)
>>> user.institution.name
'University of London'
>>> user.institution.country
'United Kingdom'
Django Rest Framework field
To serialize the institution field, you can use the InstitutionField serializer field. For example:
from django_institutions.serializer_fields import InstitutionField
class UserSerializer(serializers.ModelSerializer):
institution = InstitutionField()
REST output format
The serialized output will look like the following:
{"name": "University of London"}
Either the dict output or simply the name of the institution is acceptable as intputs.
Acknowledgements
This project is inspired by django-countries
Thanks to SmileyChris for the inspiration.
Data
The institution data is sourced from university-domains-list
Notes
This project is still very in early development. Help is welcome :)
Metadata
Release files for django-institutions 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_institutions-0.0.6.tar.gz | 205.9 kB | Without provenance | Details for django_institutions-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_institutions-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for django_institutions-0.0.6-py3-none-any.whl |
Total release size: 416.6 kB
Release files / django_institutions-0.0.6.tar.gz
| Download URL | django_institutions-0.0.6.tar.gz |
|---|---|
| Size | 205.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f16dc9d8fc16b211038d46f6f6a97aefa45781a4c38fa6beaece2e6c32b58843
|
|
BLAKE2b-256 checksum How to use checksums |
a3703919238f9bfb2c72ce2da71ed5199c305f208f5a5bb1bf03371220ad081f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / django_institutions-0.0.6-py3-none-any.whl
| Download URL | django_institutions-0.0.6-py3-none-any.whl |
|---|---|
| Size | 210.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85acb80ef7c873154e4ceb7ec4a8e7a037da93573b740979376734f944eb743c
|
|
BLAKE2b-256 checksum How to use checksums |
66504b342b6a695aa7d4ba7b0f43ef52b9cdff82bca83b5c635cf04f8f0ab751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for django-institutions 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.