#29156: Increase 'order_with_respect_to' features
-------------------------------------+-------------------------------------
Reporter: tapia | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
With `order_with_respect_to`, we can do something like this:
{{{
class Book(models.Model):
pass
class Chapter(models.Model):
book = models.ForeignKey(Book, on_delete=models.CASCADE)
class Meta:
order_with_respect_to = 'book'
}}}
It would be very nice to add some obvious features to this feature, for
example:
* `book.get_chapter_order()` returns the IDs of the chapters. Why not the
chapter objects itself?
* Given a chapter, we can get the next and the previous chapters, but we
can't easily get that chapter's order.
* It would be very nice to be able to add a chapter directly in a specific
position, pretty much like python's `insert`. For example:
`book.insert_chapter(chapter, 3)`
I know it's a very broad request, but, if you guys like the idea, I'd love
to take a look if I can add the functions myself (one at a time, to get
your approval on each of them).
--
Ticket URL: <https://code.djangoproject.com/ticket/29156>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.cc1b210d51e28141c266cb856557cc8c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.