GithubHelp home page GithubHelp logo

Comments (4)

gi0baro avatar gi0baro commented on June 2, 2024

I gonna inspect this carefully in the next few days.

Just a couple of things regarding the code you posted:

refers_to(
    {"requirement_id": "Requirement"},
    validation={'presence': True, 'allow': 'empty'}
)
  • validation is not a refers_to parameter. That code doesn't really do anything
  • presence set to True and allow set to empty are opposite conditions. They won't propagate correctly in the validation strategy. Also mind belongs_to and refers_to already configure presence validation for you.

from emmett.

SvenKeimpema avatar SvenKeimpema commented on June 2, 2024

quick question can refers_to already be null/None/empty by default? however that should't matter in this case because it should give an may-not-be empty exception or something then.

from emmett.

gi0baro avatar gi0baro commented on June 2, 2024

refers_to already won't require the field to be filled (is on the differences compared to belongs_to.
This is why I need some time to debug this, as it should work.

from emmett.

SvenKeimpema avatar SvenKeimpema commented on June 2, 2024

This is a possible fix in RowReferenceInt(helpers.py):

class RowReferenceInt(RowReferenceMixin, int):
    def __new__(cls, id, table: Table, *args: Any, **kwargs: Any):
        try:
            rv = super().__new__(cls, id, *args, **kwargs)
        except ValueError:
            return None
        int.__setattr__(rv, '_refmeta', RowReferenceMeta(table, int))
        int.__setattr__(rv, '_refrecord', None)
        return rv

this isn't a great sollution however it does work with what i have tested

from emmett.

Related Issues (20)

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.