reobject
reobject copied to clipboard
Python without ifs and buts - an ORM layer for Python objects, inspired by Django
Hello @onyb, can you please help me how to bypass unkonwn keys? For example, we only accepted 3 fields: ```python class Book(Model): title = Field() authors = Field() price =...
```python from reobject.models.manager import Manager class ReobjectManager(Manager): def get_or_create(self, defaults=None, **kwargs): self.model.objects.filter(**kwargs).delete() return super().get_or_create(defaults, **kwargs) class CourseModel(Model): course_slug = Field() title = Field() description = Field() objects = ReobjectManager() ```...
fixed #13
```python In [11]: from practical_foobar_egg_labs.courses.models.course import CourseModel In [12]: from practical_foobar_egg_labs.courses.utils.storage import CourseData In [13]: courses = CourseData().get_courses() INFO 2021-05-26 00:00:40,271 storage 1 139861811062592 [storage.py:87] [queryset_courses] Retrieved courses from cache....
I found an error when my data have an `id` or `pk` field. But, when I removed it `id`, it just working fine.  ```python from reobject.models import Model, Field...
This is supported: `Foo.objects.filter().order_by('-foo')` whereas, this is not: `Foo.objects.filter().values('email', 'foo').order_by('-foo')`
Django-style many-to-many relationships is a highly desirable feature. There might be some refactoring involved in `reobject.manager.Manager`. ```py3 class Publication(models.Model): def __init__(self, title): self.title = title ``` ```py3 class Article(Model): def...
The result returned by some `QuerySet` methods do not allow chaining with other methods due to their form. For example, the result of a `value_list` will not allow operations like...
The idea is to do something like: `SomeClass.objects.filter(val__lte=).value_list('val', flat=True).map(callable)` This needs to be spec'd properly, but some inspiration can be taken from: - http://jrsinclair.com/articles/2017/javascript-without-loops/ - http://jrsinclair.com/articles/2017/indentation-is-the-enemy-less-complex-javascript/
- Since we are purely Python 3, it would be convenient and nice to have typing information at least in the interfaces which are publicly exposed. - Add `mypy` to...