secnot / django-isbn-field Goto Github PK
View Code? Open in Web Editor NEWDjango model field to store and validate ISBN numbers.
License: GNU Lesser General Public License v3.0
Django model field to store and validate ISBN numbers.
License: GNU Lesser General Public License v3.0
Greetings @secnot and thank you for this repo.
I have encounter an issue where the field validation fails. EANs are the barcode versions of ISBNs, and there are scenarios where these numbers can pass an ISBN check sum, but still not be valid. 6610000352289, is one such example.
stdnum contains validation for EANs as well. Could you please add this validation check to prevent this from happening? I haven't come up with a good set of conditions to be absolutely sure it's an EAN and not an ISBN and vice versa (for instance, EANs can also start with 978 so that doesn't work), but perhaps the the algorithm is different between the two and that may suffice.
Thank you again!
https://www.abebooks.co.uk/9788320708011/dzieci-z-dworca-ZOO-Christiane-832070801X/plp
This books ISBN is rejected by ISBN Field
Hey @secnot,
First of all, thanks for creating and opensourcing ISBNField
!
I've run into an issue with using unique=True
. Apparently ISBNField
breaks Django's pre-save uniquess check by doing the checks using the dirty ISBN instead of the cleaned one.
I've created a failing test case here: salomvary@306ab05
Instead of the validation error, it fails with django.db.utils.IntegrityError: UNIQUE constraint failed: tests_uniquecleanisbnmodel.isbn
which is not what is expected for these cases.
The problem lies in Django getting the dirty value instead of the clean one here: https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/db/models/base.py#L1097
I am trying to come up with a workaround but as someone who has built zero custom fields so far, I might be slower than you spotting the problem. If you have any insights, let me know!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.