Comments (4)
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 arefers_to
parameter. That code doesn't really do anythingpresence
set toTrue
andallow
set toempty
are opposite conditions. They won't propagate correctly in the validation strategy. Also mindbelongs_to
andrefers_to
already configure presence validation for you.
from emmett.
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.
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.
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)
- Custom (plural) name for relationships HOT 1
- Async function db insert returns ValueError HOT 4
- Feature request widget_multiple_string_fields HOT 1
- Feature request readable, writable fields HOT 1
- Trying to do list:reference returns error HOT 6
- Copy or clone row HOT 2
- Docs Website is 503 HTTP Error HOT 1
- failed to install using python version 3.12 HOT 1
- Offering help with framework related bug fixes :)
- Debugging in vscode gives error HOT 2
- Use models in multiple databases HOT 2
- migrations set
- HTMX Support ?
- Suggestion: Snippet response support, helps with HTMX HOT 2
- Add docs for emmett.helpers HOT 3
- Suggestion: add browser reloading when running "emmett develop", similar to django-browser-reload HOT 3
- wrong database adapter in migration HOT 1
- ORM HOT 1
- `KeyError` raised for table with multiple foreign primary keys HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emmett.