Django

Code

Ticket #5372 (new)

Opened 1 year ago

Last modified 1 year ago

[newforms-admin] - caching of sql query for inlines

Reported by: anonymous Assigned to: nobody
Milestone: Component: django.contrib.admin
Version: newforms-admin Keywords: nfa-someday newforms, admin, inlines
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 1
Needs tests: 1 Patch needs improvement: 0

Attachments

newforms-admin-query-caching.diff (1.0 kB) - added by anonymous on 09/09/07 16:36:20.
caching-of-sql-queries.diff (0.7 kB) - added by Petr Marhoun <petr.marhoun@gmail.com> on 09/10/07 08:39:05.
formset_refactor_3.diff (47.2 kB) - added by brosner on 12/16/07 16:54:43.
fixes the real problem. formsets are declarative like forms. 85% done, but attaching to get feedback.

Change History

09/09/07 16:36:20 changed by anonymous

  • attachment newforms-admin-query-caching.diff added.

09/09/07 16:38:42 changed by anonymous

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

09/10/07 08:38:44 changed by Petr Marhoun <petr.marhoun@gmail.com>

I have these models:

from django.db import models

class Category(models.Model):
    name = models.CharField(max_length=255)

class Library(models.Model):
    name = models.CharField(max_length=255)
    
class Book(models.Model):
    name = models.CharField(max_length=255)
    category = models.ForeignKey(Category)
    library = models.ForeignKey(Library)
    

And I register them:

class BookInline(admin.TabularInline):
    model = Book
    extra = 10
    fields = 'name', 'category',

class LibraryOptions(admin.ModelAdmin):
    inlines = BookInline,

admin.site.register(Library, LibraryOptions)

I have ten rows for books in library add form. Each row needs its own sql query to get list of categories. I think that the query should be cached.

It is caching in one request, not between requests. New forms and new formsets are created in each request.

09/10/07 08:39:05 changed by Petr Marhoun <petr.marhoun@gmail.com>

  • attachment caching-of-sql-queries.diff added.

09/10/07 08:40:48 changed by Petr Marhoun <petr.marhoun@gmail.com>

New patch added - the old one doesn't work after [6080].

09/10/07 21:38:09 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Ready for checkin.

09/16/07 11:37:19 changed by tekNico

  • needs_docs set to 1.
  • needs_tests set to 1.
  • stage changed from Ready for checkin to Design decision needed.

The discussion about this one did not reach a consensus:

http://groups.google.com/group/django-developers/browse_thread/thread/7aaa8a5297e3c4d5

therefore I'm taking its triage stage back.

12/10/07 11:22:03 changed by brosner

  • keywords changed from newforms, admin, inlines to nfa-someday newforms, admin, inlines.
  • stage changed from Design decision needed to Accepted.

This ticket isn't critical to merge of newforms-admin. Tagging with nfa-someday. This functionality can be accomplished by the user, but I personally feel it needs to be in Django.

12/16/07 16:54:43 changed by brosner

  • attachment formset_refactor_3.diff added.

fixes the real problem. formsets are declarative like forms. 85% done, but attaching to get feedback.


Add/Change #5372 ([newforms-admin] - caching of sql query for inlines)




Change Properties
Action