Coder Social home page Coder Social logo

django-isbn-field's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-isbn-field's Issues

Field uniqueness checks are broken by clean_isbn

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!

EANs can validate as ISBNs

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.