Search code examples
pythondjangodoi

DOI field for Django Form


I would like to accept DOIs in a Django form so that when a user inputs their DOI (a DOI to a publication, for example), I can generate a link that will allow users to access the actual url. The DOI is a field in my model and I need to resolve the DOI name to 1) make sure it is a valid DOI (i.e. it exists) and 2)generate the url for users.

Can someone suggest how to go about doing this? I've looked at doi.org and crossref.org, as they do what I'm trying to do (enter a DOI, find it, and resolve it), but I don't know how to "call" that from my Django app.


Solution

  • You'll have to create a custom model field, see here, OR just use a char field with custom validators. The latter seems like the easier option.