django-relativity icon indicating copy to clipboard operation
django-relativity copied to clipboard

Default for no matching objects

Open scorpp opened this issue 2 years ago • 1 comments

It would be nice if one can specify a value/callable to use when no related objects match predicate.

In our system there is part where we classify traffic by some key. If there is no match for the key we consider it an Organic Traffic.

Unfortunately it's not possible to implement this business rule with just predicate itself.

scorpp avatar Feb 27 '23 11:02 scorpp

Hi @scorpp, thanks for your feedback.

Can you give me a more concrete idea of the models and Relationships between them in your system, and the behaviour of your proposed change to the django-relativity API?

At least initially, this sounds beyond the scope of this project - the idea of the Relationship field is to be as consistent with the Django ORM's relation fields as possible from the perspective of application code. But I'm open to being convinced.

AlexHill avatar Apr 27 '23 04:04 AlexHill